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

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

Issue 12631008: alternate ntp: implement Show/HideBars API to reduce jank when showing/hiding bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed build break Created 7 years, 9 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/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/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
240 const search::Mode& new_mode) { 240 const search::SearchModel::State& old_state,
241 const search::SearchModel::State& new_state) {
242 if (old_state.mode == new_state.mode)
243 return;
244
245 const search::Mode& new_mode = new_state.mode;
246
241 if (search::IsInstantExtendedAPIEnabled()) { 247 if (search::IsInstantExtendedAPIEnabled()) {
242 // Record some actions corresponding to the mode change. Note that to get 248 // 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, 249 // the full story, it's necessary to look at other UMA actions as well,
244 // such as tab switches. 250 // such as tab switches.
245 if (new_mode.is_search_results()) 251 if (new_mode.is_search_results())
246 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP")); 252 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
247 else if (new_mode.is_ntp()) 253 else if (new_mode.is_ntp())
248 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP")); 254 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
249 } 255 }
250 256
251 // If mode is now |NTP|, send theme-related information to Instant. 257 // If mode is now |NTP|, send theme-related information to Instant.
252 if (new_mode.is_ntp()) 258 if (new_mode.is_ntp())
253 UpdateThemeInfo(); 259 UpdateThemeInfo();
254 260
255 instant_.SearchModeChanged(old_mode, new_mode); 261 instant_.SearchModeChanged(old_state.mode, new_mode);
256 } 262 }
257 263
258 //////////////////////////////////////////////////////////////////////////////// 264 ////////////////////////////////////////////////////////////////////////////////
259 // BrowserInstantController, content::NotificationObserver implementation: 265 // BrowserInstantController, content::NotificationObserver implementation:
260 266
261 void BrowserInstantController::Observe( 267 void BrowserInstantController::Observe(
262 int type, 268 int type,
263 const content::NotificationSource& source, 269 const content::NotificationSource& source,
264 const content::NotificationDetails& details) { 270 const content::NotificationDetails& details) {
265 #if defined(ENABLE_THEMES) 271 #if defined(ENABLE_THEMES)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 initialized_theme_info_ = true; 342 initialized_theme_info_ = true;
337 } 343 }
338 344
339 DCHECK(initialized_theme_info_); 345 DCHECK(initialized_theme_info_);
340 346
341 if (browser_->search_model()->mode().is_ntp()) 347 if (browser_->search_model()->mode().is_ntp())
342 instant_.ThemeChanged(theme_info_); 348 instant_.ThemeChanged(theme_info_);
343 } 349 }
344 350
345 } // namespace chrome 351 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698