blob: 9b2ad3d4f64cafc5d8aebc4bad9f369b5c262377 [file] [log] [blame]
[email protected]e41982a72012-11-20 07:16:511// Copyright 2012 The Chromium Authors. All rights reserved.
[email protected]7acfaf92012-07-11 15:51:592// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/ui/browser_instant_controller.h"
6
[email protected]0a46856e2013-04-24 00:33:027#include "base/bind.h"
[email protected]3853a4c2013-02-11 17:15:578#include "base/prefs/pref_service.h"
[email protected]7acfaf92012-07-11 15:51:599#include "chrome/browser/extensions/extension_service.h"
[email protected]26015ac2013-02-27 02:50:1310#include "chrome/browser/extensions/extension_web_ui.h"
[email protected]7acfaf92012-07-11 15:51:5911#include "chrome/browser/profiles/profile.h"
[email protected]0a46856e2013-04-24 00:33:0212#include "chrome/browser/search/instant_service.h"
13#include "chrome/browser/search/instant_service_factory.h"
[email protected]a7b8e43d2013-03-18 18:52:4314#include "chrome/browser/search/search.h"
[email protected]0a46856e2013-04-24 00:33:0215#include "chrome/browser/search_engines/template_url.h"
16#include "chrome/browser/search_engines/template_url_service.h"
17#include "chrome/browser/search_engines/template_url_service_factory.h"
[email protected]e119b802013-02-18 18:55:3918#include "chrome/browser/themes/theme_properties.h"
[email protected]a6827652012-11-20 23:41:0819#include "chrome/browser/themes/theme_service.h"
20#include "chrome/browser/themes/theme_service_factory.h"
[email protected]7acfaf92012-07-11 15:51:5921#include "chrome/browser/ui/browser.h"
[email protected]7acfaf92012-07-11 15:51:5922#include "chrome/browser/ui/browser_window.h"
23#include "chrome/browser/ui/omnibox/location_bar.h"
[email protected]c18cb672012-12-05 04:42:1224#include "chrome/browser/ui/omnibox/omnibox_view.h"
[email protected]9d3d11702012-11-08 01:01:1225#include "chrome/browser/ui/search/search_tab_helper.h"
[email protected]e41982a72012-11-20 07:16:5126#include "chrome/browser/ui/tabs/tab_strip_model.h"
[email protected]7acfaf92012-07-11 15:51:5927#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
28#include "chrome/common/chrome_notification_types.h"
29#include "chrome/common/pref_names.h"
[email protected]0c9406632013-02-08 01:13:3330#include "chrome/common/url_constants.h"
[email protected]75fee372013-03-06 00:42:4431#include "components/user_prefs/pref_registry_syncable.h"
[email protected]7acfaf92012-07-11 15:51:5932#include "content/public/browser/notification_service.h"
[email protected]0a46856e2013-04-24 00:33:0233#include "content/public/browser/render_process_host.h"
[email protected]233f0f962013-02-27 21:14:1934#include "content/public/browser/user_metrics.h"
[email protected]0a46856e2013-04-24 00:33:0235#include "content/public/browser/web_contents.h"
[email protected]a6827652012-11-20 23:41:0836#include "grit/theme_resources.h"
37#include "ui/gfx/color_utils.h"
38#include "ui/gfx/sys_color_change_listener.h"
39
[email protected]233f0f962013-02-27 21:14:1940using content::UserMetricsAction;
41
[email protected]7acfaf92012-07-11 15:51:5942////////////////////////////////////////////////////////////////////////////////
43// BrowserInstantController, public:
44
45BrowserInstantController::BrowserInstantController(Browser* browser)
[email protected]8a236702012-09-28 13:30:5746 : browser_(browser),
[email protected]d4b2d232013-04-30 21:14:2347 instant_(this,
[email protected]165fe422013-03-27 06:34:0348 chrome::IsInstantExtendedAPIEnabled()),
[email protected]a6827652012-11-20 23:41:0849 instant_unload_handler_(browser),
[email protected]e4a379c2013-02-15 19:27:1950 initialized_theme_info_(false) {
[email protected]5879cef2013-03-02 17:02:2551
[email protected]d2bb50e2013-05-09 12:38:3452 // TODO(sreeram): Perhaps this can be removed, if field trial info is
53 // available before we need to register the pref.
[email protected]165fe422013-03-27 06:34:0354 chrome::SetInstantExtendedPrefDefault(profile());
[email protected]5879cef2013-03-02 17:02:2555
[email protected]5fac3782013-03-06 09:32:3156 profile_pref_registrar_.Init(profile()->GetPrefs());
[email protected]0b3fa502012-11-21 13:57:4657 profile_pref_registrar_.Add(
[email protected]d2bb50e2013-05-09 12:38:3458 prefs::kSearchInstantEnabled,
[email protected]0b3fa502012-11-21 13:57:4659 base::Bind(&BrowserInstantController::ResetInstant,
60 base::Unretained(this)));
[email protected]411c9c02013-02-07 04:55:5961 profile_pref_registrar_.Add(
62 prefs::kSearchSuggestEnabled,
63 base::Bind(&BrowserInstantController::ResetInstant,
64 base::Unretained(this)));
[email protected]0a46856e2013-04-24 00:33:0265 profile_pref_registrar_.Add(
66 prefs::kDefaultSearchProviderID,
67 base::Bind(&BrowserInstantController::OnDefaultSearchProviderChanged,
68 base::Unretained(this)));
[email protected]5fac3782013-03-06 09:32:3169 ResetInstant(std::string());
[email protected]0b10c9ff2012-10-09 17:31:5570 browser_->search_model()->AddObserver(this);
[email protected]a6827652012-11-20 23:41:0871
72#if defined(ENABLE_THEMES)
73 // Listen for theme installation.
74 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
75 content::Source<ThemeService>(
[email protected]0c9406632013-02-08 01:13:3376 ThemeServiceFactory::GetForProfile(profile())));
[email protected]a6827652012-11-20 23:41:0877#endif // defined(ENABLE_THEMES)
[email protected]7acfaf92012-07-11 15:51:5978}
79
80BrowserInstantController::~BrowserInstantController() {
[email protected]0b10c9ff2012-10-09 17:31:5581 browser_->search_model()->RemoveObserver(this);
[email protected]7acfaf92012-07-11 15:51:5982}
83
[email protected]0c9406632013-02-08 01:13:3384bool BrowserInstantController::MaybeSwapInInstantNTPContents(
85 const GURL& url,
86 content::WebContents* source_contents,
87 content::WebContents** target_contents) {
88 if (url != GURL(chrome::kChromeUINewTabURL))
89 return false;
90
[email protected]26015ac2013-02-27 02:50:1391 GURL extension_url(url);
92 if (ExtensionWebUI::HandleChromeURLOverride(&extension_url, profile())) {
93 // If there is an extension overriding the NTP do not use the Instant NTP.
94 return false;
95 }
96
[email protected]0c9406632013-02-08 01:13:3397 scoped_ptr<content::WebContents> instant_ntp = instant_.ReleaseNTPContents();
98 if (!instant_ntp)
99 return false;
100
101 *target_contents = instant_ntp.get();
[email protected]0c9406632013-02-08 01:13:33102 if (source_contents) {
103 instant_ntp->GetController().CopyStateFromAndPrune(
104 &source_contents->GetController());
105 ReplaceWebContentsAt(
106 browser_->tab_strip_model()->GetIndexOfWebContents(source_contents),
107 instant_ntp.Pass());
108 } else {
[email protected]57b58ca12013-02-26 23:41:25109 instant_ntp->GetController().PruneAllButActive();
[email protected]0c9406632013-02-08 01:13:33110 // If |source_contents| is NULL, then the caller is responsible for
111 // inserting instant_ntp into the tabstrip and will take ownership.
112 ignore_result(instant_ntp.release());
113 }
[email protected]0c9406632013-02-08 01:13:33114 return true;
115}
116
[email protected]7acfaf92012-07-11 15:51:59117bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) {
[email protected]e41982a72012-11-20 07:16:51118 // Unsupported dispositions.
119 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW)
[email protected]7acfaf92012-07-11 15:51:59120 return false;
[email protected]7acfaf92012-07-11 15:51:59121
[email protected]7acfaf92012-07-11 15:51:59122 // The omnibox currently doesn't use other dispositions, so we don't attempt
[email protected]c72226c82012-10-01 21:02:32123 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add
[email protected]7acfaf92012-07-11 15:51:59124 // support for the new disposition.
[email protected]c72226c82012-10-01 21:02:32125 DCHECK(disposition == CURRENT_TAB ||
126 disposition == NEW_FOREGROUND_TAB) << disposition;
127
[email protected]221e9202012-12-08 00:59:09128 return instant_.CommitIfPossible(disposition == CURRENT_TAB ?
[email protected]c72226c82012-10-01 21:02:32129 INSTANT_COMMIT_PRESSED_ENTER : INSTANT_COMMIT_PRESSED_ALT_ENTER);
[email protected]7acfaf92012-07-11 15:51:59130}
131
[email protected]0c9406632013-02-08 01:13:33132Profile* BrowserInstantController::profile() const {
133 return browser_->profile();
134}
135
136void BrowserInstantController::CommitInstant(
[email protected]ddd28ae2013-03-04 21:11:54137 scoped_ptr<content::WebContents> overlay,
[email protected]0c9406632013-02-08 01:13:33138 bool in_new_tab) {
[email protected]79f17ef462013-03-24 00:28:18139 const extensions::Extension* extension =
140 profile()->GetExtensionService()->GetInstalledApp(overlay->GetURL());
141 if (extension) {
[email protected]0c9406632013-02-08 01:13:33142 AppLauncherHandler::RecordAppLaunchType(
[email protected]79f17ef462013-03-24 00:28:18143 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT,
144 extension->GetType());
[email protected]0c9406632013-02-08 01:13:33145 }
[email protected]c72226c82012-10-01 21:02:32146 if (in_new_tab) {
[email protected]ddd28ae2013-03-04 21:11:54147 // TabStripModel takes ownership of |overlay|.
148 browser_->tab_strip_model()->AddWebContents(overlay.release(), -1,
[email protected]e41982a72012-11-20 07:16:51149 instant_.last_transition_type(), TabStripModel::ADD_ACTIVE);
[email protected]c72226c82012-10-01 21:02:32150 } else {
[email protected]9bc3f242013-04-05 23:27:36151 content::WebContents* contents = overlay.get();
[email protected]0c9406632013-02-08 01:13:33152 ReplaceWebContentsAt(
153 browser_->tab_strip_model()->active_index(),
[email protected]ddd28ae2013-03-04 21:11:54154 overlay.Pass());
[email protected]9bc3f242013-04-05 23:27:36155 browser_->window()->GetLocationBar()->SaveStateToContents(contents);
[email protected]7acfaf92012-07-11 15:51:59156 }
157}
158
[email protected]0c9406632013-02-08 01:13:33159void BrowserInstantController::ReplaceWebContentsAt(
160 int index,
161 scoped_ptr<content::WebContents> new_contents) {
162 DCHECK_NE(TabStripModel::kNoTab, index);
[email protected]d572bfd2013-02-14 06:14:20163 scoped_ptr<content::WebContents> old_contents(browser_->tab_strip_model()->
164 ReplaceWebContentsAt(index, new_contents.release()));
165 instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents.Pass(),
166 index);
[email protected]0c9406632013-02-08 01:13:33167}
168
[email protected]93b73832012-10-18 20:18:38169void BrowserInstantController::SetInstantSuggestion(
170 const InstantSuggestion& suggestion) {
[email protected]c18cb672012-12-05 04:42:12171 browser_->window()->GetLocationBar()->SetInstantSuggestion(suggestion);
[email protected]7acfaf92012-07-11 15:51:59172}
173
[email protected]7acfaf92012-07-11 15:51:59174gfx::Rect BrowserInstantController::GetInstantBounds() {
175 return browser_->window()->GetInstantBounds();
176}
177
[email protected]ddd28ae2013-03-04 21:11:54178void BrowserInstantController::InstantOverlayFocused() {
[email protected]7acfaf92012-07-11 15:51:59179 // NOTE: This is only invoked on aura.
[email protected]ddd28ae2013-03-04 21:11:54180 browser_->window()->WebContentsFocused(instant_.GetOverlayContents());
[email protected]7acfaf92012-07-11 15:51:59181}
182
[email protected]10aec592013-03-06 20:19:00183void BrowserInstantController::FocusOmnibox(bool caret_visibility) {
[email protected]c18cb672012-12-05 04:42:12184 OmniboxView* omnibox_view = browser_->window()->GetLocationBar()->
185 GetLocationEntry();
186 omnibox_view->SetFocus();
[email protected]10aec592013-03-06 20:19:00187 omnibox_view->model()->SetCaretVisibility(caret_visibility);
[email protected]c18cb672012-12-05 04:42:12188}
189
[email protected]cd533bf2012-12-04 19:14:59190content::WebContents* BrowserInstantController::GetActiveWebContents() const {
191 return browser_->tab_strip_model()->GetActiveWebContents();
[email protected]7acfaf92012-07-11 15:51:59192}
193
[email protected]e41982a72012-11-20 07:16:51194void BrowserInstantController::ActiveTabChanged() {
195 instant_.ActiveTabChanged();
196}
197
[email protected]3d6a8952012-12-14 03:18:07198void BrowserInstantController::TabDeactivated(content::WebContents* contents) {
199 instant_.TabDeactivated(contents);
200}
201
[email protected]3870363e2013-03-06 20:11:23202void BrowserInstantController::UpdateThemeInfo() {
[email protected]e4a379c2013-02-15 19:27:19203 // Update theme background info.
[email protected]3870363e2013-03-06 20:11:23204 // Initialize |theme_info| if necessary.
205 if (!initialized_theme_info_)
[email protected]0c9406632013-02-08 01:13:33206 OnThemeChanged(ThemeServiceFactory::GetForProfile(profile()));
[email protected]a6827652012-11-20 23:41:08207 else
208 OnThemeChanged(NULL);
209}
210
[email protected]3c3acca2013-02-26 03:07:07211void BrowserInstantController::OpenURL(
[email protected]e3033eb2012-12-13 23:46:08212 const GURL& url,
[email protected]3c3acca2013-02-26 03:07:07213 content::PageTransition transition,
214 WindowOpenDisposition disposition) {
[email protected]e3033eb2012-12-13 23:46:08215 browser_->OpenURL(content::OpenURLParams(url,
216 content::Referrer(),
[email protected]3c3acca2013-02-26 03:07:07217 disposition,
[email protected]e3033eb2012-12-13 23:46:08218 transition,
219 false));
220}
221
[email protected]fcde79a2013-02-28 02:25:09222void BrowserInstantController::SetOmniboxBounds(const gfx::Rect& bounds) {
223 instant_.SetOmniboxBounds(bounds);
[email protected]ec4aad542012-12-14 01:11:04224}
225
[email protected]5fac3782013-03-06 09:32:31226void BrowserInstantController::ResetInstant(const std::string& pref_name) {
[email protected]a1a83ef62013-04-29 19:15:43227 bool instant_checkbox_checked = chrome::IsInstantCheckboxChecked(profile());
228 bool use_local_overlay_only =
[email protected]07fd48a2013-04-13 02:53:27229 chrome::IsLocalOnlyInstantExtendedAPIEnabled() ||
[email protected]a1a83ef62013-04-29 19:15:43230 !chrome::IsInstantCheckboxEnabled(profile());
231 instant_.SetInstantEnabled(instant_checkbox_checked, use_local_overlay_only);
[email protected]749ce882012-11-16 04:18:01232}
233
[email protected]7acfaf92012-07-11 15:51:59234////////////////////////////////////////////////////////////////////////////////
[email protected]165fe422013-03-27 06:34:03235// BrowserInstantController, SearchModelObserver implementation:
[email protected]0b10c9ff2012-10-09 17:31:55236
[email protected]5ee671f2013-03-19 11:23:05237void BrowserInstantController::ModelChanged(
[email protected]165fe422013-03-27 06:34:03238 const SearchModel::State& old_state,
239 const SearchModel::State& new_state) {
[email protected]5ee671f2013-03-19 11:23:05240 if (old_state.mode == new_state.mode)
241 return;
242
[email protected]165fe422013-03-27 06:34:03243 const SearchMode& new_mode = new_state.mode;
[email protected]5ee671f2013-03-19 11:23:05244
[email protected]165fe422013-03-27 06:34:03245 if (chrome::IsInstantExtendedAPIEnabled()) {
[email protected]c19ba1042013-03-11 17:17:13246 // Record some actions corresponding to the mode change. Note that to get
247 // the full story, it's necessary to look at other UMA actions as well,
248 // such as tab switches.
249 if (new_mode.is_search_results())
250 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
251 else if (new_mode.is_ntp())
252 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
253 }
254
[email protected]ddd28ae2013-03-04 21:11:54255 // If mode is now |NTP|, send theme-related information to Instant.
[email protected]a6827652012-11-20 23:41:08256 if (new_mode.is_ntp())
[email protected]3870363e2013-03-06 20:11:23257 UpdateThemeInfo();
[email protected]a6827652012-11-20 23:41:08258
[email protected]5ee671f2013-03-19 11:23:05259 instant_.SearchModeChanged(old_state.mode, new_mode);
[email protected]7acfaf92012-07-11 15:51:59260}
261
[email protected]a6827652012-11-20 23:41:08262////////////////////////////////////////////////////////////////////////////////
263// BrowserInstantController, content::NotificationObserver implementation:
264
265void BrowserInstantController::Observe(
266 int type,
267 const content::NotificationSource& source,
268 const content::NotificationDetails& details) {
269#if defined(ENABLE_THEMES)
270 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
271 OnThemeChanged(content::Source<ThemeService>(source).ptr());
272#endif // defined(ENABLE_THEMES)
273}
274
275void BrowserInstantController::OnThemeChanged(ThemeService* theme_service) {
276 if (theme_service) { // Get theme information from theme service.
277 theme_info_ = ThemeBackgroundInfo();
278
279 // Set theme background color.
280 SkColor background_color =
[email protected]e119b802013-02-18 18:55:39281 theme_service->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND);
[email protected]a6827652012-11-20 23:41:08282 if (gfx::IsInvertedColorScheme())
283 background_color = color_utils::InvertColor(background_color);
284 theme_info_.color_r = SkColorGetR(background_color);
285 theme_info_.color_g = SkColorGetG(background_color);
286 theme_info_.color_b = SkColorGetB(background_color);
287 theme_info_.color_a = SkColorGetA(background_color);
288
289 if (theme_service->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) {
290 // Set theme id for theme background image url.
291 theme_info_.theme_id = theme_service->GetThemeID();
292
293 // Set theme background image horizontal alignment.
294 int alignment = 0;
[email protected]e119b802013-02-18 18:55:39295 theme_service->GetDisplayProperty(
296 ThemeProperties::NTP_BACKGROUND_ALIGNMENT, &alignment);
297 if (alignment & ThemeProperties::ALIGN_LEFT) {
[email protected]a6827652012-11-20 23:41:08298 theme_info_.image_horizontal_alignment = THEME_BKGRND_IMAGE_ALIGN_LEFT;
[email protected]e119b802013-02-18 18:55:39299 } else if (alignment & ThemeProperties::ALIGN_RIGHT) {
[email protected]a6827652012-11-20 23:41:08300 theme_info_.image_horizontal_alignment = THEME_BKGRND_IMAGE_ALIGN_RIGHT;
301 } else { // ALIGN_CENTER
302 theme_info_.image_horizontal_alignment =
303 THEME_BKGRND_IMAGE_ALIGN_CENTER;
304 }
305
306 // Set theme background image vertical alignment.
[email protected]3870363e2013-03-06 20:11:23307 if (alignment & ThemeProperties::ALIGN_TOP)
[email protected]a6827652012-11-20 23:41:08308 theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_TOP;
[email protected]3870363e2013-03-06 20:11:23309 else if (alignment & ThemeProperties::ALIGN_BOTTOM)
[email protected]a6827652012-11-20 23:41:08310 theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_BOTTOM;
[email protected]3870363e2013-03-06 20:11:23311 else // ALIGN_CENTER
[email protected]a6827652012-11-20 23:41:08312 theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_CENTER;
[email protected]a6827652012-11-20 23:41:08313
314 // Set theme background image tiling.
315 int tiling = 0;
[email protected]e119b802013-02-18 18:55:39316 theme_service->GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_TILING,
[email protected]a6827652012-11-20 23:41:08317 &tiling);
318 switch (tiling) {
[email protected]e119b802013-02-18 18:55:39319 case ThemeProperties::NO_REPEAT:
[email protected]a6827652012-11-20 23:41:08320 theme_info_.image_tiling = THEME_BKGRND_IMAGE_NO_REPEAT;
321 break;
[email protected]e119b802013-02-18 18:55:39322 case ThemeProperties::REPEAT_X:
[email protected]a6827652012-11-20 23:41:08323 theme_info_.image_tiling = THEME_BKGRND_IMAGE_REPEAT_X;
324 break;
[email protected]e119b802013-02-18 18:55:39325 case ThemeProperties::REPEAT_Y:
[email protected]a6827652012-11-20 23:41:08326 theme_info_.image_tiling = THEME_BKGRND_IMAGE_REPEAT_Y;
327 break;
[email protected]e119b802013-02-18 18:55:39328 case ThemeProperties::REPEAT:
[email protected]a6827652012-11-20 23:41:08329 theme_info_.image_tiling = THEME_BKGRND_IMAGE_REPEAT;
330 break;
331 }
332
333 // Set theme background image height.
334 gfx::ImageSkia* image = theme_service->GetImageSkiaNamed(
335 IDR_THEME_NTP_BACKGROUND);
336 DCHECK(image);
337 theme_info_.image_height = image->height();
[email protected]5189fa12013-03-20 23:00:05338
339 theme_info_.has_attribution =
340 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION);
[email protected]a6827652012-11-20 23:41:08341 }
342
343 initialized_theme_info_ = true;
344 }
345
346 DCHECK(initialized_theme_info_);
347
[email protected]e4a379c2013-02-15 19:27:19348 if (browser_->search_model()->mode().is_ntp())
[email protected]a6827652012-11-20 23:41:08349 instant_.ThemeChanged(theme_info_);
[email protected]a6827652012-11-20 23:41:08350}
[email protected]0a46856e2013-04-24 00:33:02351
352void BrowserInstantController::OnDefaultSearchProviderChanged(
353 const std::string& pref_name) {
354 DCHECK_EQ(pref_name, std::string(prefs::kDefaultSearchProviderID));
355
356 Profile* browser_profile = profile();
357 const TemplateURL* template_url =
358 TemplateURLServiceFactory::GetForProfile(browser_profile)->
359 GetDefaultSearchProvider();
360 if (!template_url) {
361 // A NULL |template_url| could mean either this notification is sent during
362 // the browser start up operation or the user now has no default search
363 // provider. There is no way for the user to reach this state using the
364 // Chrome settings. Only explicitly poking at the DB or bugs in the Sync
365 // could cause that, neither of which we support.
366 return;
367 }
368
369 InstantService* instant_service =
370 InstantServiceFactory::GetForProfile(browser_profile);
371 if (!instant_service)
372 return;
373
374 TabStripModel* tab_model = browser_->tab_strip_model();
375 int count = tab_model->count();
376 for (int index = 0; index < count; ++index) {
377 content::WebContents* contents = tab_model->GetWebContentsAt(index);
378 if (!contents)
379 continue;
380
381 // A Local NTP always runs in the Instant process, so reloading it is
382 // neither useful nor necessary. However, the Local NTP does not reflect
383 // whether Google is the default search engine or not. This is achieved
384 // through a URL parameter, so reloading the existing URL won't fix that
385 // (i.e., the Local NTP may now show an incorrect search engine logo).
386 // TODO(kmadhusu): Fix.
387 if (contents->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl))
388 continue;
389
390 if (!instant_service->IsInstantProcess(
391 contents->GetRenderProcessHost()->GetID()))
392 continue;
393
394 // Reload the contents to ensure that it gets assigned to a non-priviledged
395 // renderer.
396 contents->GetController().Reload(false);
397 }
398 instant_.OnDefaultSearchProviderChanged();
399}