OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/webui/options/chromeos/stats_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/stats_options_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
12 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
13 | 13 |
14 using content::UserMetricsAction; | 14 using content::UserMetricsAction; |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 StatsOptionsHandler::StatsOptionsHandler() { | 18 StatsOptionsHandler::StatsOptionsHandler() { |
19 } | 19 } |
20 | 20 |
21 // OptionsPageUIHandler implementation. | 21 // OptionsPageUIHandler implementation. |
22 void StatsOptionsHandler::GetLocalizedValues( | 22 void StatsOptionsHandler::GetLocalizedValues( |
23 DictionaryValue* localized_strings) { | 23 DictionaryValue* localized_strings) { |
24 } | 24 } |
25 | 25 |
26 void StatsOptionsHandler::Initialize() { | |
27 } | |
28 | |
29 // WebUIMessageHandler implementation. | 26 // WebUIMessageHandler implementation. |
30 void StatsOptionsHandler::RegisterMessages() { | 27 void StatsOptionsHandler::RegisterMessages() { |
31 web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction", | 28 web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction", |
32 base::Bind(&StatsOptionsHandler::HandleMetricsReportingCheckbox, | 29 base::Bind(&StatsOptionsHandler::HandleMetricsReportingCheckbox, |
33 base::Unretained(this))); | 30 base::Unretained(this))); |
34 } | 31 } |
35 | 32 |
36 void StatsOptionsHandler::HandleMetricsReportingCheckbox( | 33 void StatsOptionsHandler::HandleMetricsReportingCheckbox( |
37 const ListValue* args) { | 34 const ListValue* args) { |
38 #if defined(GOOGLE_CHROME_BUILD) | 35 #if defined(GOOGLE_CHROME_BUILD) |
39 const std::string checked_str = UTF16ToUTF8(ExtractStringValue(args)); | 36 const std::string checked_str = UTF16ToUTF8(ExtractStringValue(args)); |
40 const bool enabled = (checked_str == "true"); | 37 const bool enabled = (checked_str == "true"); |
41 content::RecordAction( | 38 content::RecordAction( |
42 enabled ? | 39 enabled ? |
43 UserMetricsAction("Options_MetricsReportingCheckbox_Enable") : | 40 UserMetricsAction("Options_MetricsReportingCheckbox_Enable") : |
44 UserMetricsAction("Options_MetricsReportingCheckbox_Disable")); | 41 UserMetricsAction("Options_MetricsReportingCheckbox_Disable")); |
45 #endif | 42 #endif |
46 } | 43 } |
47 | 44 |
48 } // namespace chromeos | 45 } // namespace chromeos |
OLD | NEW |