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); | |
51 | 45 |
52 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; | 46 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; |
53 PreferenceCallbackMap pref_callback_map_; | 47 PreferenceCallbackMap pref_callback_map_; |
54 private: | 48 private: |
55 // Callback for the "coreOptionsInitialize" message. This message will | 49 // Callback for the "coreOptionsInitialize" message. This message will |
56 // trigger the Initialize() method of all other handlers so that final | 50 // trigger the Initialize() method of all other handlers so that final |
57 // setup can be performed before the page is shown. | 51 // setup can be performed before the page is shown. |
58 void HandleInitialize(const ListValue* args); | 52 void HandleInitialize(const ListValue* args); |
59 | 53 |
60 // Callback for the "fetchPrefs" message. This message accepts the list of | 54 // Callback for the "fetchPrefs" message. This message accepts the list of |
61 // preference names passed as |value| parameter (ListValue). It passes results | 55 // preference names passed as |value| parameter (ListValue). It passes results |
62 // dictionary of preference values by calling prefsFetched() JS method on the | 56 // dictionary of preference values by calling prefsFetched() JS method on the |
63 // page. | 57 // page. |
64 void HandleFetchPrefs(const ListValue* args); | 58 void HandleFetchPrefs(const ListValue* args); |
65 | 59 |
66 // Callback for the "observePrefs" message. This message initiates | 60 // Callback for the "observePrefs" message. This message initiates |
67 // notification observing for given array of preference names. | 61 // notification observing for given array of preference names. |
68 void HandleObservePrefs(const ListValue* args); | 62 void HandleObservePrefs(const ListValue* args); |
69 | 63 |
70 // Callbacks for the "set<type>Pref" message. This message saves the new | 64 // Callbacks for the "set<type>Pref" message. This message saves the new |
71 // preference value. The input value is an array of strings representing | 65 // preference value. The input value is an array of strings representing |
72 // name-value preference pair. | 66 // name-value preference pair. |
73 void HandleSetBooleanPref(const ListValue* args); | 67 void HandleSetBooleanPref(const ListValue* args); |
74 void HandleSetIntegerPref(const ListValue* args); | 68 void HandleSetIntegerPref(const ListValue* args); |
75 void HandleSetStringPref(const ListValue* args); | 69 void HandleSetStringPref(const ListValue* args); |
76 void HandleSetObjectPref(const ListValue* args); | 70 void HandleSetObjectPref(const ListValue* args); |
77 | 71 |
78 void HandleSetPref(const ListValue* args, Value::ValueType type); | 72 void HandleSetPref(const ListValue* args, Value::ValueType type); |
79 | 73 |
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 | |
84 void NotifyPrefChanged(const std::string* pref_name); | 74 void NotifyPrefChanged(const std::string* pref_name); |
85 | 75 |
86 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); | 76 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); |
87 }; | 77 }; |
88 | 78 |
89 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 79 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
OLD | NEW |