| Index: chrome/browser/dom_ui/core_options_handler.cc
|
| ===================================================================
|
| --- chrome/browser/dom_ui/core_options_handler.cc (revision 57095)
|
| +++ chrome/browser/dom_ui/core_options_handler.cc (working copy)
|
| @@ -9,11 +9,10 @@
|
| #include "base/string_number_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/metrics/user_metrics.h"
|
| -#include "chrome/browser/pref_service.h"
|
| -#include "chrome/browser/profile.h"
|
| #include "chrome/common/notification_service.h"
|
| #include "chrome/common/notification_type.h"
|
| +#include "chrome/browser/pref_service.h"
|
| +#include "chrome/browser/profile.h"
|
| #include "grit/browser_resources.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| @@ -111,8 +110,6 @@
|
| NewCallback(this, &CoreOptionsHandler::HandleSetStringPref));
|
| dom_ui_->RegisterMessageCallback("setObjectPref",
|
| NewCallback(this, &CoreOptionsHandler::HandleSetObjectPref));
|
| - dom_ui_->RegisterMessageCallback("coreOptionsUserMetricsAction",
|
| - NewCallback(this, &CoreOptionsHandler::HandleUserMetricsAction));
|
| }
|
|
|
| void CoreOptionsHandler::HandleInitialize(const ListValue* args) {
|
| @@ -146,8 +143,7 @@
|
|
|
| void CoreOptionsHandler::SetPref(const std::string& pref_name,
|
| Value::ValueType pref_type,
|
| - const std::string& value_string,
|
| - const std::string& metric) {
|
| + const std::string& value_string) {
|
| DCHECK(dom_ui_);
|
| PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs();
|
|
|
| @@ -166,24 +162,8 @@
|
| default:
|
| NOTREACHED();
|
| }
|
| -
|
| - ProcessUserMetric(pref_type, value_string, metric);
|
| }
|
|
|
| -void CoreOptionsHandler::ProcessUserMetric(Value::ValueType pref_type,
|
| - const std::string& value_string,
|
| - const std::string& metric) {
|
| - if (metric.empty())
|
| - return;
|
| -
|
| - std::string metric_string = metric;
|
| - if (pref_type == Value::TYPE_BOOLEAN)
|
| - metric_string += (value_string == "true" ? "_Enable" : "_Disable");
|
| -
|
| - UserMetricsRecordAction(UserMetricsAction(metric_string.c_str()),
|
| - dom_ui_->GetProfile()->GetPrefs());
|
| -}
|
| -
|
| void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) {
|
| // First param is name of callback function, so, there needs to be at least
|
| // one more element for the actual preference identifier.
|
| @@ -222,6 +202,8 @@
|
| }
|
|
|
| void CoreOptionsHandler::HandleObservePrefs(const ListValue* args) {
|
| + DictionaryValue result_value;
|
| +
|
| // First param is name is JS callback function name, the rest are pref
|
| // identifiers that we are observing.
|
| const size_t kMinObservePrefsParamCount = 2;
|
| @@ -272,7 +254,7 @@
|
|
|
| void CoreOptionsHandler::HandleSetPref(const ListValue* args,
|
| Value::ValueType type) {
|
| - if (args->GetSize() < 2)
|
| + if (args->GetSize() != 2)
|
| return;
|
|
|
| std::string pref_name;
|
| @@ -283,19 +265,9 @@
|
| if (!args->GetString(1, &value_string))
|
| return;
|
|
|
| - std::string metric;
|
| - if (args->GetSize() > 2)
|
| - args->GetString(2, &metric);
|
| -
|
| - SetPref(pref_name, type, value_string, metric);
|
| + SetPref(pref_name, type, value_string);
|
| }
|
|
|
| -void CoreOptionsHandler::HandleUserMetricsAction(const ListValue* args) {
|
| - std::string metric = WideToUTF8(ExtractStringValue(args));
|
| - if (!metric.empty())
|
| - UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL);
|
| -}
|
| -
|
| void CoreOptionsHandler::NotifyPrefChanged(const std::string* pref_name) {
|
| DCHECK(pref_name);
|
| DCHECK(dom_ui_);
|
|
|