| 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);
|
|
|