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

Unified 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: Addressed nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_instant_controller.cc
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index 008753e789bf6608b7df751c357af2c50355cbad..0219145650463ff67f9d373d34a46b8651194d1f 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
+#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
@@ -275,26 +276,28 @@ void BrowserInstantController::ResetInstant(const std::string& pref_name) {
void BrowserInstantController::ModelChanged(
const SearchModel::State& old_state,
const SearchModel::State& new_state) {
- if (old_state.mode == new_state.mode)
- return;
+ if (old_state.mode != new_state.mode) {
+ const SearchMode& new_mode = new_state.mode;
+
+ if (chrome::IsInstantExtendedAPIEnabled()) {
+ // Record some actions corresponding to the mode change. Note that to get
+ // the full story, it's necessary to look at other UMA actions as well,
+ // such as tab switches.
+ if (new_mode.is_search_results())
+ content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
+ else if (new_mode.is_ntp())
+ content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
+ }
- const SearchMode& new_mode = new_state.mode;
+ // If mode is now |NTP|, send theme-related information to Instant.
+ if (new_mode.is_ntp())
+ UpdateThemeInfo();
- if (chrome::IsInstantExtendedAPIEnabled()) {
- // Record some actions corresponding to the mode change. Note that to get
- // the full story, it's necessary to look at other UMA actions as well,
- // such as tab switches.
- if (new_mode.is_search_results())
- content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
- else if (new_mode.is_ntp())
- content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
+ instant_.SearchModeChanged(old_state.mode, new_mode);
}
- // If mode is now |NTP|, send theme-related information to Instant.
- if (new_mode.is_ntp())
- UpdateThemeInfo();
-
- instant_.SearchModeChanged(old_state.mode, new_mode);
+ if (old_state.instant_support != new_state.instant_support)
+ instant_.InstantSupportChanged(new_state.instant_support);
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698