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

Side by Side Diff: chrome/browser/dom_ui/browser_options_handler.cc

Issue 3190004: dom-ui options: record user metrics for pref changes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase to r56963. Created 10 years, 4 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/browser_options_handler.h" 5 #include "chrome/browser/dom_ui/browser_options_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chrome_thread.h" 14 #include "chrome/browser/chrome_thread.h"
15 #include "chrome/browser/custom_home_pages_table_model.h" 15 #include "chrome/browser/custom_home_pages_table_model.h"
16 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" 16 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
17 #include "chrome/browser/dom_ui/options_managed_banner_handler.h" 17 #include "chrome/browser/dom_ui/options_managed_banner_handler.h"
18 #include "chrome/browser/metrics/user_metrics.h"
18 #include "chrome/browser/net/url_fixer_upper.h" 19 #include "chrome/browser/net/url_fixer_upper.h"
19 #include "chrome/browser/profile.h" 20 #include "chrome/browser/profile.h"
20 #include "chrome/browser/options_window.h" 21 #include "chrome/browser/options_window.h"
21 #include "chrome/browser/session_startup_pref.h" 22 #include "chrome/browser/session_startup_pref.h"
22 #include "chrome/installer/util/browser_distribution.h" 23 #include "chrome/installer/util/browser_distribution.h"
23 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 26
26 BrowserOptionsHandler::BrowserOptionsHandler() 27 BrowserOptionsHandler::BrowserOptionsHandler()
27 : template_url_model_(NULL), startup_custom_pages_table_model_(NULL) { 28 : template_url_model_(NULL), startup_custom_pages_table_model_(NULL) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 else 133 else
133 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; 134 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN;
134 135
135 SetDefaultBrowserUIString(status_string_id); 136 SetDefaultBrowserUIString(status_string_id);
136 #else 137 #else
137 default_browser_worker_->StartCheckDefaultBrowser(); 138 default_browser_worker_->StartCheckDefaultBrowser();
138 #endif 139 #endif
139 } 140 }
140 141
141 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) { 142 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) {
143 UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser"),
144 NULL);
142 #if defined(OS_MACOSX) 145 #if defined(OS_MACOSX)
143 if (ShellIntegration::SetAsDefaultBrowser()) 146 if (ShellIntegration::SetAsDefaultBrowser())
144 UpdateDefaultBrowserState(); 147 UpdateDefaultBrowserState();
145 #else 148 #else
146 default_browser_worker_->StartSetAsDefaultBrowser(); 149 default_browser_worker_->StartSetAsDefaultBrowser();
147 // Callback takes care of updating UI. 150 // Callback takes care of updating UI.
148 #endif 151 #endif
149 } 152 }
150 153
151 int BrowserOptionsHandler::StatusStringIdForState( 154 int BrowserOptionsHandler::StatusStringIdForState(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (!ExtractIntegerValue(args, &selected_index)) { 222 if (!ExtractIntegerValue(args, &selected_index)) {
220 NOTREACHED(); 223 NOTREACHED();
221 return; 224 return;
222 } 225 }
223 226
224 std::vector<const TemplateURL*> model_urls = 227 std::vector<const TemplateURL*> model_urls =
225 template_url_model_->GetTemplateURLs(); 228 template_url_model_->GetTemplateURLs();
226 if (selected_index >= 0 && 229 if (selected_index >= 0 &&
227 selected_index < static_cast<int>(model_urls.size())) 230 selected_index < static_cast<int>(model_urls.size()))
228 template_url_model_->SetDefaultSearchProvider(model_urls[selected_index]); 231 template_url_model_->SetDefaultSearchProvider(model_urls[selected_index]);
232
233 UserMetricsRecordAction(UserMetricsAction("Options_SearchEngineChanged"),
234 NULL);
229 } 235 }
230 236
231 void BrowserOptionsHandler::UpdateSearchEngines() { 237 void BrowserOptionsHandler::UpdateSearchEngines() {
232 template_url_model_ = dom_ui_->GetProfile()->GetTemplateURLModel(); 238 template_url_model_ = dom_ui_->GetProfile()->GetTemplateURLModel();
233 if (template_url_model_) { 239 if (template_url_model_) {
234 template_url_model_->Load(); 240 template_url_model_->Load();
235 template_url_model_->AddObserver(this); 241 template_url_model_->AddObserver(this);
236 OnTemplateURLModelChanged(); 242 OnTemplateURLModelChanged();
237 } 243 }
238 } 244 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 334 }
329 335
330 void BrowserOptionsHandler::SaveStartupPagesPref() { 336 void BrowserOptionsHandler::SaveStartupPagesPref() {
331 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); 337 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs();
332 338
333 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); 339 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
334 pref.urls = startup_custom_pages_table_model_->GetURLs(); 340 pref.urls = startup_custom_pages_table_model_->GetURLs();
335 341
336 SessionStartupPref::SetStartupPref(prefs, pref); 342 SessionStartupPref::SetStartupPref(prefs, pref);
337 } 343 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/advanced_options_handler.cc ('k') | chrome/browser/dom_ui/core_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698