| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Fetches a pref value of given |pref_name|. | 34 // Fetches a pref value of given |pref_name|. |
| 35 // Note that caller owns the returned Value. | 35 // Note that caller owns the returned Value. |
| 36 virtual Value* FetchPref(const std::string& pref_name); | 36 virtual Value* FetchPref(const std::string& pref_name); |
| 37 | 37 |
| 38 // Observes a pref of given |pref_name|. | 38 // Observes a pref of given |pref_name|. |
| 39 virtual void ObservePref(const std::string& pref_name); | 39 virtual void ObservePref(const std::string& pref_name); |
| 40 | 40 |
| 41 // Sets a pref value |value_string| of |pref_type| to given |pref_name|. | 41 // Sets a pref value |value_string| of |pref_type| to given |pref_name|. |
| 42 virtual void SetPref(const std::string& pref_name, | 42 virtual void SetPref(const std::string& pref_name, |
| 43 Value::ValueType pref_type, | 43 Value::ValueType pref_type, |
| 44 const std::string& value_string); | 44 const std::string& value_string, |
| 45 const std::string& metric); |
| 46 |
| 47 // Records a user metric action for the given value. |
| 48 void ProcessUserMetric(Value::ValueType pref_type, |
| 49 const std::string& value_string, |
| 50 const std::string& metric); |
| 45 | 51 |
| 46 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; | 52 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; |
| 47 PreferenceCallbackMap pref_callback_map_; | 53 PreferenceCallbackMap pref_callback_map_; |
| 48 private: | 54 private: |
| 49 // Callback for the "coreOptionsInitialize" message. This message will | 55 // Callback for the "coreOptionsInitialize" message. This message will |
| 50 // trigger the Initialize() method of all other handlers so that final | 56 // trigger the Initialize() method of all other handlers so that final |
| 51 // setup can be performed before the page is shown. | 57 // setup can be performed before the page is shown. |
| 52 void HandleInitialize(const ListValue* args); | 58 void HandleInitialize(const ListValue* args); |
| 53 | 59 |
| 54 // Callback for the "fetchPrefs" message. This message accepts the list of | 60 // Callback for the "fetchPrefs" message. This message accepts the list of |
| 55 // preference names passed as |value| parameter (ListValue). It passes results | 61 // preference names passed as |value| parameter (ListValue). It passes results |
| 56 // dictionary of preference values by calling prefsFetched() JS method on the | 62 // dictionary of preference values by calling prefsFetched() JS method on the |
| 57 // page. | 63 // page. |
| 58 void HandleFetchPrefs(const ListValue* args); | 64 void HandleFetchPrefs(const ListValue* args); |
| 59 | 65 |
| 60 // Callback for the "observePrefs" message. This message initiates | 66 // Callback for the "observePrefs" message. This message initiates |
| 61 // notification observing for given array of preference names. | 67 // notification observing for given array of preference names. |
| 62 void HandleObservePrefs(const ListValue* args); | 68 void HandleObservePrefs(const ListValue* args); |
| 63 | 69 |
| 64 // Callbacks for the "set<type>Pref" message. This message saves the new | 70 // Callbacks for the "set<type>Pref" message. This message saves the new |
| 65 // preference value. The input value is an array of strings representing | 71 // preference value. The input value is an array of strings representing |
| 66 // name-value preference pair. | 72 // name-value preference pair. |
| 67 void HandleSetBooleanPref(const ListValue* args); | 73 void HandleSetBooleanPref(const ListValue* args); |
| 68 void HandleSetIntegerPref(const ListValue* args); | 74 void HandleSetIntegerPref(const ListValue* args); |
| 69 void HandleSetStringPref(const ListValue* args); | 75 void HandleSetStringPref(const ListValue* args); |
| 70 void HandleSetObjectPref(const ListValue* args); | 76 void HandleSetObjectPref(const ListValue* args); |
| 71 | 77 |
| 72 void HandleSetPref(const ListValue* args, Value::ValueType type); | 78 void HandleSetPref(const ListValue* args, Value::ValueType type); |
| 73 | 79 |
| 80 // Callback for the "coreOptionsUserMetricsAction" message. This records |
| 81 // an action that should be tracked if metrics recording is enabled. |
| 82 void HandleUserMetricsAction(const ListValue* args); |
| 83 |
| 74 void NotifyPrefChanged(const std::string* pref_name); | 84 void NotifyPrefChanged(const std::string* pref_name); |
| 75 | 85 |
| 76 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); | 86 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); |
| 77 }; | 87 }; |
| 78 | 88 |
| 79 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 89 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
| OLD | NEW |