Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.h

Issue 2820823005: Revert of Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
10 #include <string> 9 #include <string>
11 10
12 #include "base/callback.h" 11 #include "base/callback.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "base/values.h" 13 #include "base/values.h"
15 #include "chrome/browser/plugins/plugin_status_pref_setter.h" 14 #include "chrome/browser/plugins/plugin_status_pref_setter.h"
16 #include "chrome/browser/ui/webui/options/options_ui.h" 15 #include "chrome/browser/ui/webui/options/options_ui.h"
17 #include "components/prefs/pref_change_registrar.h" 16 #include "components/prefs/pref_change_registrar.h"
18 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
19 18
(...skipping 19 matching lines...) Expand all
39 handlers_host_ = handlers_host; 38 handlers_host_ = handlers_host;
40 } 39 }
41 40
42 // Adds localized strings to |localized_strings|. 41 // Adds localized strings to |localized_strings|.
43 static void GetStaticLocalizedValues( 42 static void GetStaticLocalizedValues(
44 base::DictionaryValue* localized_strings); 43 base::DictionaryValue* localized_strings);
45 44
46 protected: 45 protected:
47 // Fetches a pref value of given |pref_name|. 46 // Fetches a pref value of given |pref_name|.
48 // Note that caller owns the returned Value. 47 // Note that caller owns the returned Value.
49 virtual std::unique_ptr<base::Value> FetchPref(const std::string& pref_name); 48 virtual base::Value* FetchPref(const std::string& pref_name);
50 49
51 // Observes a pref of given |pref_name|. 50 // Observes a pref of given |pref_name|.
52 virtual void ObservePref(const std::string& pref_name); 51 virtual void ObservePref(const std::string& pref_name);
53 52
54 // Stops observing given preference identified by |pref_name|. 53 // Stops observing given preference identified by |pref_name|.
55 virtual void StopObservingPref(const std::string& pref_name); 54 virtual void StopObservingPref(const std::string& pref_name);
56 55
57 // Sets a pref |value| to given |pref_name|. 56 // Sets a pref |value| to given |pref_name|.
58 virtual void SetPref(const std::string& pref_name, 57 virtual void SetPref(const std::string& pref_name,
59 const base::Value* value, 58 const base::Value* value,
(...skipping 22 matching lines...) Expand all
82 81
83 // Calls JS callbacks to report a change in the value of the |name| 82 // Calls JS callbacks to report a change in the value of the |name|
84 // preference. |value| is the new value for |name|. Called from 83 // preference. |value| is the new value for |name|. Called from
85 // Notify*Changed methods to fire off the notifications. 84 // Notify*Changed methods to fire off the notifications.
86 void DispatchPrefChangeNotification(const std::string& name, 85 void DispatchPrefChangeNotification(const std::string& name,
87 std::unique_ptr<base::Value> value); 86 std::unique_ptr<base::Value> value);
88 87
89 // Creates dictionary value for the pref described by |pref_name|. 88 // Creates dictionary value for the pref described by |pref_name|.
90 // If |controlling_pref| is not empty, it describes the pref that manages 89 // If |controlling_pref| is not empty, it describes the pref that manages
91 // |pref| via policy or extension. 90 // |pref| via policy or extension.
92 virtual std::unique_ptr<base::Value> CreateValueForPref( 91 virtual base::Value* CreateValueForPref(
93 const std::string& pref_name, 92 const std::string& pref_name,
94 const std::string& controlling_pref_name); 93 const std::string& controlling_pref_name);
95 94
96 typedef std::multimap<std::string, std::string> PreferenceCallbackMap; 95 typedef std::multimap<std::string, std::string> PreferenceCallbackMap;
97 PreferenceCallbackMap pref_callback_map_; 96 PreferenceCallbackMap pref_callback_map_;
98 97
99 private: 98 private:
100 // Type of preference value received from the page. This doesn't map 1:1 to 99 // Type of preference value received from the page. This doesn't map 1:1 to
101 // Value::Type, since a TYPE_STRING can require custom processing. 100 // Value::Type, since a TYPE_STRING can require custom processing.
102 enum PrefType { 101 enum PrefType {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 typedef std::map<std::string, base::Callback<bool(const base::Value*)> > 181 typedef std::map<std::string, base::Callback<bool(const base::Value*)> >
183 PrefChangeFilterMap; 182 PrefChangeFilterMap;
184 PrefChangeFilterMap pref_change_filters_; 183 PrefChangeFilterMap pref_change_filters_;
185 184
186 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); 185 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler);
187 }; 186 };
188 187
189 } // namespace options 188 } // namespace options
190 189
191 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 190 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | chrome/browser/ui/webui/options/core_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698