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