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

Side by Side Diff: chrome/browser/ui/webui/settings/search_engines_handler.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/webui/settings/search_engines_handler.h" 5 #include "chrome/browser/ui/webui/settings/search_engines_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/user_metrics.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chrome/browser/extensions/extension_util.h" 14 #include "chrome/browser/extensions/extension_util.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/search/hotword_audio_history_handler.h" 16 #include "chrome/browser/search/hotword_audio_history_handler.h"
16 #include "chrome/browser/search/hotword_service.h" 17 #include "chrome/browser/search/hotword_service.h"
17 #include "chrome/browser/search/hotword_service_factory.h" 18 #include "chrome/browser/search/hotword_service_factory.h"
18 #include "chrome/browser/search_engines/template_url_service_factory.h" 19 #include "chrome/browser/search_engines/template_url_service_factory.h"
19 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 20 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
20 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
21 #include "chrome/browser/ui/search_engines/template_url_table_model.h" 22 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
25 #include "components/prefs/pref_service.h" 26 #include "components/prefs/pref_service.h"
26 #include "components/search_engines/template_url.h" 27 #include "components/search_engines/template_url.h"
27 #include "components/search_engines/template_url_service.h" 28 #include "components/search_engines/template_url_service.h"
28 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
29 #include "content/public/browser/user_metrics.h"
30 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
31 #include "extensions/browser/extension_registry.h" 31 #include "extensions/browser/extension_registry.h"
32 #include "extensions/browser/extension_system.h" 32 #include "extensions/browser/extension_system.h"
33 #include "extensions/browser/management_policy.h" 33 #include "extensions/browser/management_policy.h"
34 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 36
37 namespace { 37 namespace {
38 // The following strings need to match with the IDs of the paper-input elements 38 // The following strings need to match with the IDs of the paper-input elements
39 // at settings/search_engines_page/add_search_engine_dialog.html. 39 // at settings/search_engines_page/add_search_engine_dialog.html.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // MakeDefaultTemplateURL. 294 // MakeDefaultTemplateURL.
295 if (!IsGoogleDefaultSearch(profile_)) { 295 if (!IsGoogleDefaultSearch(profile_)) {
296 HotwordService* hotword_service = 296 HotwordService* hotword_service =
297 HotwordServiceFactory::GetForProfile(profile_); 297 HotwordServiceFactory::GetForProfile(profile_);
298 if (hotword_service) 298 if (hotword_service)
299 hotword_service->DisableHotwordPreferences(); 299 hotword_service->DisableHotwordPreferences();
300 } 300 }
301 // Hotword status may have changed. 301 // Hotword status may have changed.
302 SendHotwordInfo(); 302 SendHotwordInfo();
303 303
304 content::RecordAction( 304 base::RecordAction(base::UserMetricsAction("Options_SearchEngineSetDefault"));
305 base::UserMetricsAction("Options_SearchEngineSetDefault"));
306 } 305 }
307 306
308 void SearchEnginesHandler::HandleRemoveSearchEngine( 307 void SearchEnginesHandler::HandleRemoveSearchEngine(
309 const base::ListValue* args) { 308 const base::ListValue* args) {
310 int index; 309 int index;
311 if (!ExtractIntegerValue(args, &index)) { 310 if (!ExtractIntegerValue(args, &index)) {
312 NOTREACHED(); 311 NOTREACHED();
313 return; 312 return;
314 } 313 }
315 if (index < 0 || index >= list_controller_.table_model()->RowCount()) 314 if (index < 0 || index >= list_controller_.table_model()->RowCount())
316 return; 315 return;
317 316
318 if (list_controller_.CanRemove(list_controller_.GetTemplateURL(index))) { 317 if (list_controller_.CanRemove(list_controller_.GetTemplateURL(index))) {
319 list_controller_.RemoveTemplateURL(index); 318 list_controller_.RemoveTemplateURL(index);
320 content::RecordAction( 319 base::RecordAction(base::UserMetricsAction("Options_SearchEngineRemoved"));
321 base::UserMetricsAction("Options_SearchEngineRemoved"));
322 } 320 }
323 } 321 }
324 322
325 void SearchEnginesHandler::HandleSearchEngineEditStarted( 323 void SearchEnginesHandler::HandleSearchEngineEditStarted(
326 const base::ListValue* args) { 324 const base::ListValue* args) {
327 int index; 325 int index;
328 if (!ExtractIntegerValue(args, &index)) { 326 if (!ExtractIntegerValue(args, &index)) {
329 NOTREACHED(); 327 NOTREACHED();
330 return; 328 return;
331 } 329 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 bool logging_enabled = 553 bool logging_enabled =
556 profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled); 554 profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled);
557 launch_mode = logging_enabled ? HotwordService::HOTWORD_ONLY 555 launch_mode = logging_enabled ? HotwordService::HOTWORD_ONLY
558 : HotwordService::HOTWORD_AND_AUDIO_HISTORY; 556 : HotwordService::HOTWORD_AND_AUDIO_HISTORY;
559 } 557 }
560 hotword_service->OptIntoHotwording(launch_mode); 558 hotword_service->OptIntoHotwording(launch_mode);
561 SendHotwordInfo(); 559 SendHotwordInfo();
562 } 560 }
563 561
564 } // namespace settings 562 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/reset_settings_handler.cc ('k') | chrome/browser/ui/webui/signin/inline_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698