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