Bug 568925 - Remote History Set Title for URI. r=cjones, sr=bz
authorDoug Turner <dougt@dougt.org>
Fri, 02 Jul 2010 08:53:42 -0700
changeset 48342 2900644a71c6d4810d079456a472c25d58a8fe8a
parent 48341 c6673716fd47d00edcdb8d9724bf3c5de04013f2
child 48343 7be6a577f698b2e925cda6a723a29dc41f2c1158
push id14685
push userdougt@mozilla.com
push dateThu, 29 Jul 2010 04:04:15 +0000
treeherdermozilla-central@b099bad53068 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones, bz
bugs568925
milestone2.0b3pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 568925 - Remote History Set Title for URI. r=cjones, sr=bz
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
toolkit/components/places/src/History.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -449,16 +449,27 @@ ContentParent::RecvVisitURI(const IPC::U
 {
     nsCOMPtr<nsIURI> ourURI = uri;
     nsCOMPtr<nsIURI> ourReferrer = referrer;
     IHistory *history = nsContentUtils::GetHistory(); 
     history->VisitURI(ourURI, ourReferrer, flags);
     return true;
 }
 
+
+bool
+ContentParent::RecvSetURITitle(const IPC::URI& uri,
+                                      const nsString& title)
+{
+    nsCOMPtr<nsIURI> ourURI = uri;
+    IHistory *history = nsContentUtils::GetHistory(); 
+    history->SetURITitle(ourURI, title);
+    return true;
+}
+
 /* void onDispatchedEvent (in nsIThreadInternal thread); */
 NS_IMETHODIMP
 ContentParent::OnDispatchedEvent(nsIThreadInternal *thread)
 {
     if (mOldObserver)
         return mOldObserver->OnDispatchedEvent(thread);
 
     return NS_OK;
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -147,16 +147,19 @@ private:
     void EnsurePermissionService();
 
     virtual bool RecvStartVisitedQuery(const IPC::URI& uri);
 
     virtual bool RecvVisitURI(const IPC::URI& uri,
                               const IPC::URI& referrer,
                               const PRUint32& flags);
 
+    virtual bool RecvSetURITitle(const IPC::URI& uri,
+                                 const nsString& title);
+
     mozilla::Monitor mMonitor;
 
     GeckoChildProcessHost* mSubprocess;
 
     int mRunToCompletionDepth;
     bool mShouldCallUnblockChild;
     nsCOMPtr<nsIThreadObserver> mOldObserver;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -74,16 +74,17 @@ child:
 
 parent:
     PNecko();
 
     // Services remoting
 
     async StartVisitedQuery(URI uri);
     async VisitURI(URI uri, URI referrer, PRUint32 flags);
+    async SetURITitle(URI uri, nsString title);
 
     // PrefService messages
     sync GetPrefType(nsCString prefName) returns (PRInt32 retValue, nsresult rv);
     sync GetBoolPref(nsCString prefName) returns (PRBool retValue, nsresult rv);
     sync GetIntPref(nsCString prefName)  returns (PRInt32 retValue, nsresult rv);
     sync GetCharPref(nsCString prefName) returns (nsCString retValue, nsresult rv);
     sync GetPrefLocalizedString(nsCString prefName) returns (nsString retValue, nsresult rv);
     sync PrefHasUserValue(nsCString prefName) returns (PRBool retValue, nsresult rv);
--- a/toolkit/components/places/src/History.cpp
+++ b/toolkit/components/places/src/History.cpp
@@ -1259,16 +1259,26 @@ History::UnregisterVisitedCallback(nsIUR
 NS_IMETHODIMP
 History::SetURITitle(nsIURI* aURI, const nsAString& aTitle)
 {
   NS_PRECONDITION(aURI, "Must pass a non-null URI!");
   if (mShuttingDown) {
     return NS_OK;
   }
 
+#ifdef MOZ_IPC
+  if (XRE_GetProcessType() == GeckoProcessType_Content) {
+    mozilla::dom::ContentChild * cpc = 
+      mozilla::dom::ContentChild::GetSingleton();
+    NS_ASSERTION(cpc, "Content Protocol is NULL!");
+    (void)cpc->SendSetURITitle(IPC::URI(aURI), nsDependentString(aTitle));
+    return NS_OK;
+  } 
+#endif /* MOZ_IPC */
+
   nsNavHistory* history = nsNavHistory::GetHistoryService();
 
   // At first, it seems like nav history should always be available here, no
   // matter what.
   //
   // nsNavHistory fails to register as a service if there is no profile in
   // place (for instance, if user is choosing a profile).
   //