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