Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: chrome/browser/search/instant_service.cc

Issue 23455047: InstantExtended: Send search URLs to renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More browsertest fixes Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/search/instant_service.h ('k') | chrome/browser/search/instant_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/instant_service.cc
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index c50d2716d87d52072854f151e122b3cca84284c1..2ae370d2b9a208b87124a5f9e87615f13047dfc7 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/render_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -73,6 +74,9 @@ InstantService::InstantService(Profile* profile)
return;
registrar_.Add(this,
+ content::NOTIFICATION_RENDERER_PROCESS_CREATED,
+ content::NotificationService::AllSources());
+ registrar_.Add(this,
content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllSources());
@@ -233,21 +237,14 @@ void InstantService::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
- int process_id =
- content::Source<content::RenderProcessHost>(source)->GetID();
- process_ids_.erase(process_id);
-
- if (instant_io_context_.get()) {
- BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(&InstantIOContext::RemoveInstantProcessOnIO,
- instant_io_context_,
- process_id));
- }
+ case content::NOTIFICATION_RENDERER_PROCESS_CREATED:
+ SendSearchURLsToRenderer(
+ content::Source<content::RenderProcessHost>(source).ptr());
+ break;
+ case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED:
+ OnRendererProcessTerminated(
+ content::Source<content::RenderProcessHost>(source)->GetID());
break;
- }
case chrome::NOTIFICATION_TOP_SITES_CHANGED: {
history::TopSites* top_sites = profile_->GetTopSites();
if (top_sites) {
@@ -284,6 +281,24 @@ void InstantService::Observe(int type,
}
}
+void InstantService::SendSearchURLsToRenderer(content::RenderProcessHost* rph) {
+ rph->Send(new ChromeViewMsg_SetSearchURLs(
+ chrome::GetSearchURLs(profile_), chrome::GetNewTabPageURL(profile_)));
+}
+
+void InstantService::OnRendererProcessTerminated(int process_id) {
+ process_ids_.erase(process_id);
+
+ if (instant_io_context_.get()) {
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&InstantIOContext::RemoveInstantProcessOnIO,
+ instant_io_context_,
+ process_id));
+ }
+}
+
void InstantService::OnMostVisitedItemsReceived(
const history::MostVisitedURLList& data) {
history::MostVisitedURLList reordered_data(data);
« no previous file with comments | « chrome/browser/search/instant_service.h ('k') | chrome/browser/search/instant_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698