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

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: Handle TemplateURL change 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
Index: chrome/browser/search/instant_service.cc
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index 62e8580219b32d5f12b5399ba1ae5057c5085115..a7dc714d092eea2f13932451f43ef1b010f52423 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/webui/favicon_source.h"
#include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
#include "chrome/browser/ui/webui/theme_source.h"
+#include "chrome/common/render_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -65,6 +66,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());
@@ -215,21 +219,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) {
@@ -260,6 +257,24 @@ void InstantService::Observe(int type,
}
}
+void InstantService::SendSearchURLsToRenderer(content::RenderProcessHost* rph) {
samarth 2013/09/20 16:43:40 Test please. Anuj's pending change adds a unit tes
Jered 2013/09/20 20:55:49 I added a simple test. I'll merge up to Anuj's cha
+ 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);

Powered by Google App Engine
This is Rietveld 408576698