| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_PREFERENCE_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 class PrefTransformerInterface { | 44 class PrefTransformerInterface { |
| 45 public: | 45 public: |
| 46 virtual ~PrefTransformerInterface() {} | 46 virtual ~PrefTransformerInterface() {} |
| 47 | 47 |
| 48 // Converts the representation of a preference as seen by the extension | 48 // Converts the representation of a preference as seen by the extension |
| 49 // into a representation that is used in the pref stores of the browser. | 49 // into a representation that is used in the pref stores of the browser. |
| 50 // Returns the pref store representation in case of success or sets | 50 // Returns the pref store representation in case of success or sets |
| 51 // |error| and returns NULL otherwise. | 51 // |error| and returns NULL otherwise. |
| 52 // The ownership of the returned value is passed to the caller. | 52 // The ownership of the returned value is passed to the caller. |
| 53 // TODO(battre): add bool* bad_message to allow terminating the entire |
| 54 // extension in order to simulate the behavior of EXTENSION_FUNCTION_VALIDATE. |
| 53 virtual Value* ExtensionToBrowserPref(const Value* extension_pref, | 55 virtual Value* ExtensionToBrowserPref(const Value* extension_pref, |
| 54 std::string* error) = 0; | 56 std::string* error) = 0; |
| 55 | 57 |
| 56 // Converts the representation of the preference as stored in the browser | 58 // Converts the representation of the preference as stored in the browser |
| 57 // into a representation that is used by the extension. | 59 // into a representation that is used by the extension. |
| 58 // Returns the extension representation in case of success or NULL otherwise. | 60 // Returns the extension representation in case of success or NULL otherwise. |
| 59 // The ownership of the returned value is passed to the caller. | 61 // The ownership of the returned value is passed to the caller. |
| 60 virtual Value* BrowserToExtensionPref(const Value* browser_pref) = 0; | 62 virtual Value* BrowserToExtensionPref(const Value* browser_pref) = 0; |
| 61 }; | 63 }; |
| 62 | 64 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 class ClearPreferenceFunction : public SyncExtensionFunction { | 79 class ClearPreferenceFunction : public SyncExtensionFunction { |
| 78 public: | 80 public: |
| 79 virtual ~ClearPreferenceFunction(); | 81 virtual ~ClearPreferenceFunction(); |
| 80 virtual bool RunImpl(); | 82 virtual bool RunImpl(); |
| 81 DECLARE_EXTENSION_FUNCTION_NAME("experimental.preferences.clear") | 83 DECLARE_EXTENSION_FUNCTION_NAME("experimental.preferences.clear") |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ | 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
| OLD | NEW |