| OLD | NEW |
| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_web_ui.h" | 9 #include "chrome/browser/extensions/extension_web_ui.h" |
| 10 #include "chrome/browser/instant/search.h" | 10 #include "chrome/browser/instant/search.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 bool instant_pref_enabled = chrome::search::IsInstantPrefEnabled(profile()); | 229 bool instant_pref_enabled = chrome::search::IsInstantPrefEnabled(profile()); |
| 230 bool use_local_overlay_only = profile()->IsOffTheRecord() || | 230 bool use_local_overlay_only = profile()->IsOffTheRecord() || |
| 231 (!instant_pref_enabled && | 231 (!instant_pref_enabled && |
| 232 !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)); | 232 !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)); |
| 233 instant_.SetInstantEnabled(instant_pref_enabled, use_local_overlay_only); | 233 instant_.SetInstantEnabled(instant_pref_enabled, use_local_overlay_only); |
| 234 } | 234 } |
| 235 | 235 |
| 236 //////////////////////////////////////////////////////////////////////////////// | 236 //////////////////////////////////////////////////////////////////////////////// |
| 237 // BrowserInstantController, search::SearchModelObserver implementation: | 237 // BrowserInstantController, search::SearchModelObserver implementation: |
| 238 | 238 |
| 239 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 239 void BrowserInstantController::ModelChanged(const search::Mode& old_mode, |
| 240 const search::Mode& new_mode) { | 240 const search::Mode& new_mode, |
| 241 bool top_bars_visible) { |
| 242 if (old_mode == new_mode) |
| 243 return; |
| 244 |
| 241 if (search::IsInstantExtendedAPIEnabled()) { | 245 if (search::IsInstantExtendedAPIEnabled()) { |
| 242 // Record some actions corresponding to the mode change. Note that to get | 246 // Record some actions corresponding to the mode change. Note that to get |
| 243 // the full story, it's necessary to look at other UMA actions as well, | 247 // the full story, it's necessary to look at other UMA actions as well, |
| 244 // such as tab switches. | 248 // such as tab switches. |
| 245 if (new_mode.is_search_results()) | 249 if (new_mode.is_search_results()) |
| 246 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP")); | 250 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP")); |
| 247 else if (new_mode.is_ntp()) | 251 else if (new_mode.is_ntp()) |
| 248 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP")); | 252 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP")); |
| 249 } | 253 } |
| 250 | 254 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 initialized_theme_info_ = true; | 340 initialized_theme_info_ = true; |
| 337 } | 341 } |
| 338 | 342 |
| 339 DCHECK(initialized_theme_info_); | 343 DCHECK(initialized_theme_info_); |
| 340 | 344 |
| 341 if (browser_->search_model()->mode().is_ntp()) | 345 if (browser_->search_model()->mode().is_ntp()) |
| 342 instant_.ThemeChanged(theme_info_); | 346 instant_.ThemeChanged(theme_info_); |
| 343 } | 347 } |
| 344 | 348 |
| 345 } // namespace chrome | 349 } // namespace chrome |
| OLD | NEW |