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

Side by Side Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 16035020: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_instant_controller.h" 5 #include "chrome/browser/ui/browser_instant_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_web_ui.h" 10 #include "chrome/browser/extensions/extension_web_ui.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 !chrome::IsInstantCheckboxEnabled(profile()); 260 !chrome::IsInstantCheckboxEnabled(profile());
261 instant_.SetInstantEnabled(instant_checkbox_checked, use_local_overlay_only); 261 instant_.SetInstantEnabled(instant_checkbox_checked, use_local_overlay_only);
262 } 262 }
263 263
264 //////////////////////////////////////////////////////////////////////////////// 264 ////////////////////////////////////////////////////////////////////////////////
265 // BrowserInstantController, SearchModelObserver implementation: 265 // BrowserInstantController, SearchModelObserver implementation:
266 266
267 void BrowserInstantController::ModelChanged( 267 void BrowserInstantController::ModelChanged(
268 const SearchModel::State& old_state, 268 const SearchModel::State& old_state,
269 const SearchModel::State& new_state) { 269 const SearchModel::State& new_state) {
270 if (old_state.mode == new_state.mode) 270 if (old_state.mode == new_state.mode &&
271 old_state.instant_support == new_state.instant_support)
samarth 2013/06/14 00:17:10 This is not strictly correct. The code below assu
kmadhusu 2013/06/17 16:49:19 Good catch. Fixed.
271 return; 272 return;
272 273
273 const SearchMode& new_mode = new_state.mode; 274 const SearchMode& new_mode = new_state.mode;
274 275
275 if (chrome::IsInstantExtendedAPIEnabled()) { 276 if (chrome::IsInstantExtendedAPIEnabled()) {
276 // Record some actions corresponding to the mode change. Note that to get 277 // Record some actions corresponding to the mode change. Note that to get
277 // the full story, it's necessary to look at other UMA actions as well, 278 // the full story, it's necessary to look at other UMA actions as well,
278 // such as tab switches. 279 // such as tab switches.
279 if (new_mode.is_search_results()) 280 if (new_mode.is_search_results())
280 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP")); 281 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
281 else if (new_mode.is_ntp()) 282 else if (new_mode.is_ntp())
282 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP")); 283 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
283 } 284 }
284 285
285 // If mode is now |NTP|, send theme-related information to Instant. 286 // If mode is now |NTP|, send theme-related information to Instant.
286 if (new_mode.is_ntp()) 287 if (new_mode.is_ntp())
287 UpdateThemeInfo(); 288 UpdateThemeInfo();
288 289
289 instant_.SearchModeChanged(old_state.mode, new_mode); 290 instant_.SearchModeChanged(old_state.mode, new_mode);
samarth 2013/06/14 00:17:10 Likewise, we probably don't want all of this funct
kmadhusu 2013/06/17 16:49:19 Done.
290 } 291 }
291 292
292 //////////////////////////////////////////////////////////////////////////////// 293 ////////////////////////////////////////////////////////////////////////////////
293 // BrowserInstantController, content::NotificationObserver implementation: 294 // BrowserInstantController, content::NotificationObserver implementation:
294 295
295 void BrowserInstantController::Observe( 296 void BrowserInstantController::Observe(
296 int type, 297 int type,
297 const content::NotificationSource& source, 298 const content::NotificationSource& source,
298 const content::NotificationDetails& details) { 299 const content::NotificationDetails& details) {
299 #if defined(ENABLE_THEMES) 300 #if defined(ENABLE_THEMES)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (!instant_service->IsInstantProcess( 421 if (!instant_service->IsInstantProcess(
421 contents->GetRenderProcessHost()->GetID())) 422 contents->GetRenderProcessHost()->GetID()))
422 continue; 423 continue;
423 424
424 // Reload the contents to ensure that it gets assigned to a non-priviledged 425 // Reload the contents to ensure that it gets assigned to a non-priviledged
425 // renderer. 426 // renderer.
426 contents->GetController().Reload(false); 427 contents->GetController().Reload(false);
427 } 428 }
428 instant_.OnDefaultSearchProviderChanged(); 429 instant_.OnDefaultSearchProviderChanged();
429 } 430 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698