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

Side by Side Diff: chrome/browser/extensions/api/preference/preference_api.h

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (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_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
7 7
8 #include <memory>
9 #include <string> 8 #include <string>
10 9
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
13 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h" 12 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h"
14 #include "chrome/browser/extensions/chrome_extension_function.h" 13 #include "chrome/browser/extensions/chrome_extension_function.h"
15 #include "components/prefs/pref_change_registrar.h" 14 #include "components/prefs/pref_change_registrar.h"
16 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 16 #include "extensions/browser/browser_context_keyed_api_factory.h"
18 #include "extensions/browser/event_router.h" 17 #include "extensions/browser/event_router.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 class PrefTransformerInterface { 144 class PrefTransformerInterface {
146 public: 145 public:
147 virtual ~PrefTransformerInterface() {} 146 virtual ~PrefTransformerInterface() {}
148 147
149 // Converts the representation of a preference as seen by the extension 148 // Converts the representation of a preference as seen by the extension
150 // into a representation that is used in the pref stores of the browser. 149 // into a representation that is used in the pref stores of the browser.
151 // Returns the pref store representation in case of success or sets 150 // Returns the pref store representation in case of success or sets
152 // |error| and returns NULL otherwise. |bad_message| is passed to simulate 151 // |error| and returns NULL otherwise. |bad_message| is passed to simulate
153 // the behavior of EXTENSION_FUNCTION_VALIDATE. It is never NULL. 152 // the behavior of EXTENSION_FUNCTION_VALIDATE. It is never NULL.
154 // The ownership of the returned value is passed to the caller. 153 // The ownership of the returned value is passed to the caller.
155 virtual std::unique_ptr<base::Value> ExtensionToBrowserPref( 154 virtual base::Value* ExtensionToBrowserPref(
156 const base::Value* extension_pref, 155 const base::Value* extension_pref,
157 std::string* error, 156 std::string* error,
158 bool* bad_message) = 0; 157 bool* bad_message) = 0;
159 158
160 // Converts the representation of the preference as stored in the browser 159 // Converts the representation of the preference as stored in the browser
161 // into a representation that is used by the extension. 160 // into a representation that is used by the extension.
162 // Returns the extension representation in case of success or NULL otherwise. 161 // Returns the extension representation in case of success or NULL otherwise.
163 // The ownership of the returned value is passed to the caller. 162 // The ownership of the returned value is passed to the caller.
164 virtual std::unique_ptr<base::Value> BrowserToExtensionPref( 163 virtual base::Value* BrowserToExtensionPref(
165 const base::Value* browser_pref) = 0; 164 const base::Value* browser_pref) = 0;
166 }; 165 };
167 166
168 // A base class to provide functionality common to the other *PreferenceFunction 167 // A base class to provide functionality common to the other *PreferenceFunction
169 // classes. 168 // classes.
170 class PreferenceFunction : public UIThreadExtensionFunction { 169 class PreferenceFunction : public UIThreadExtensionFunction {
171 protected: 170 protected:
172 enum PermissionType { PERMISSION_TYPE_READ, PERMISSION_TYPE_WRITE }; 171 enum PermissionType { PERMISSION_TYPE_READ, PERMISSION_TYPE_WRITE };
173 172
174 ~PreferenceFunction() override; 173 ~PreferenceFunction() override;
(...skipping 29 matching lines...) Expand all
204 protected: 203 protected:
205 ~ClearPreferenceFunction() override; 204 ~ClearPreferenceFunction() override;
206 205
207 // ExtensionFunction: 206 // ExtensionFunction:
208 ResponseAction Run() override; 207 ResponseAction Run() override;
209 }; 208 };
210 209
211 } // namespace extensions 210 } // namespace extensions
212 211
213 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 212 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698