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

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

Issue 12546011: Add UMA action InstantExtended.ShowSRP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « no previous file | chrome/tools/chromeactions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/instant/search.h" 10 #include "chrome/browser/instant/search.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 &source_contents->GetController()); 100 &source_contents->GetController());
101 ReplaceWebContentsAt( 101 ReplaceWebContentsAt(
102 browser_->tab_strip_model()->GetIndexOfWebContents(source_contents), 102 browser_->tab_strip_model()->GetIndexOfWebContents(source_contents),
103 instant_ntp.Pass()); 103 instant_ntp.Pass());
104 } else { 104 } else {
105 instant_ntp->GetController().PruneAllButActive(); 105 instant_ntp->GetController().PruneAllButActive();
106 // If |source_contents| is NULL, then the caller is responsible for 106 // If |source_contents| is NULL, then the caller is responsible for
107 // inserting instant_ntp into the tabstrip and will take ownership. 107 // inserting instant_ntp into the tabstrip and will take ownership.
108 ignore_result(instant_ntp.release()); 108 ignore_result(instant_ntp.release());
109 } 109 }
110 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
111 return true; 110 return true;
112 } 111 }
113 112
114 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { 113 bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) {
115 // Unsupported dispositions. 114 // Unsupported dispositions.
116 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW) 115 if (disposition == NEW_BACKGROUND_TAB || disposition == NEW_WINDOW)
117 return false; 116 return false;
118 117
119 // The omnibox currently doesn't use other dispositions, so we don't attempt 118 // The omnibox currently doesn't use other dispositions, so we don't attempt
120 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add 119 // to handle them. If you hit this DCHECK file a bug and I'll (sky) add
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 (!instant_pref_enabled && 231 (!instant_pref_enabled &&
233 !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)); 232 !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled));
234 instant_.SetInstantEnabled(instant_pref_enabled, use_local_overlay_only); 233 instant_.SetInstantEnabled(instant_pref_enabled, use_local_overlay_only);
235 } 234 }
236 235
237 //////////////////////////////////////////////////////////////////////////////// 236 ////////////////////////////////////////////////////////////////////////////////
238 // BrowserInstantController, search::SearchModelObserver implementation: 237 // BrowserInstantController, search::SearchModelObserver implementation:
239 238
240 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, 239 void BrowserInstantController::ModeChanged(const search::Mode& old_mode,
241 const search::Mode& new_mode) { 240 const search::Mode& new_mode) {
241 if (search::IsInstantExtendedAPIEnabled()) {
242 // 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,
244 // such as tab switches.
245 if (new_mode.is_search_results())
246 content::RecordAction(UserMetricsAction("InstantExtended.ShowSRP"));
247 else if (new_mode.is_ntp())
248 content::RecordAction(UserMetricsAction("InstantExtended.ShowNTP"));
249 }
250
242 // If mode is now |NTP|, send theme-related information to Instant. 251 // If mode is now |NTP|, send theme-related information to Instant.
243 if (new_mode.is_ntp()) 252 if (new_mode.is_ntp())
244 UpdateThemeInfo(); 253 UpdateThemeInfo();
245 254
246 instant_.SearchModeChanged(old_mode, new_mode); 255 instant_.SearchModeChanged(old_mode, new_mode);
247 } 256 }
248 257
249 //////////////////////////////////////////////////////////////////////////////// 258 ////////////////////////////////////////////////////////////////////////////////
250 // BrowserInstantController, content::NotificationObserver implementation: 259 // BrowserInstantController, content::NotificationObserver implementation:
251 260
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 initialized_theme_info_ = true; 336 initialized_theme_info_ = true;
328 } 337 }
329 338
330 DCHECK(initialized_theme_info_); 339 DCHECK(initialized_theme_info_);
331 340
332 if (browser_->search_model()->mode().is_ntp()) 341 if (browser_->search_model()->mode().is_ntp())
333 instant_.ThemeChanged(theme_info_); 342 instant_.ThemeChanged(theme_info_);
334 } 343 }
335 344
336 } // namespace chrome 345 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/tools/chromeactions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698