Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / chromeos / stats_options_handler.cc
blob7f3c3a47fa9d3a4ab86a25fccfc5c4b5ab8b5b8c
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/options/chromeos/stats_options_handler.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h"
11 #include "content/public/browser/user_metrics.h"
12 #include "content/public/browser/web_ui.h"
14 using base::UserMetricsAction;
16 namespace chromeos {
17 namespace options {
19 StatsOptionsHandler::StatsOptionsHandler() {
22 // OptionsPageUIHandler implementation.
23 void StatsOptionsHandler::GetLocalizedValues(
24 base::DictionaryValue* localized_strings) {
27 // WebUIMessageHandler implementation.
28 void StatsOptionsHandler::RegisterMessages() {
29 web_ui()->RegisterMessageCallback("metricsReportingCheckboxAction",
30 base::Bind(&StatsOptionsHandler::HandleMetricsReportingCheckbox,
31 base::Unretained(this)));
34 void StatsOptionsHandler::HandleMetricsReportingCheckbox(
35 const base::ListValue* args) {
36 #if defined(GOOGLE_CHROME_BUILD)
37 const std::string checked_str = base::UTF16ToUTF8(ExtractStringValue(args));
38 const bool enabled = (checked_str == "true");
39 content::RecordAction(
40 enabled ?
41 UserMetricsAction("Options_MetricsReportingCheckbox_Enable") :
42 UserMetricsAction("Options_MetricsReportingCheckbox_Disable"));
43 #endif
46 } // namespace options
47 } // namespace chromeos