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_SETTINGS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // | 21 // |
22 // Implementations should fill in args themselves, though (like RunImpl) | 22 // Implementations should fill in args themselves, though (like RunImpl) |
23 // may return false to imply failure. | 23 // may return false to imply failure. |
24 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) = 0; | 24 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) = 0; |
25 | 25 |
26 // Sets error_ or result_ depending on the value of a storage Result, and | 26 // Sets error_ or result_ depending on the value of a storage Result, and |
27 // returns whether the Result implies success (i.e. !error). | 27 // returns whether the Result implies success (i.e. !error). |
28 bool UseResult(const ExtensionSettingsStorage::Result& storage_result); | 28 bool UseResult(const ExtensionSettingsStorage::Result& storage_result); |
29 | 29 |
30 private: | 30 private: |
31 // Component of RunImpl which runs on the FILE thread. | 31 // Called via PostTask from RunImpl. Calls RunWithStorage and then |
32 void RunOnFileThread(); | 32 // SendReponse with its success value. |
| 33 void RunWithSettingsOnFileThread(ExtensionSettings* settings); |
33 }; | 34 }; |
34 | 35 |
35 class GetSettingsFunction : public SettingsFunction { | 36 class GetSettingsFunction : public SettingsFunction { |
36 public: | 37 public: |
37 DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.get"); | 38 DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.get"); |
38 | 39 |
39 protected: | 40 protected: |
40 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) OVERRIDE; | 41 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) OVERRIDE; |
41 }; | 42 }; |
42 | 43 |
(...skipping 15 matching lines...) Expand all Loading... |
58 | 59 |
59 class ClearSettingsFunction : public SettingsFunction { | 60 class ClearSettingsFunction : public SettingsFunction { |
60 public: | 61 public: |
61 DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.clear"); | 62 DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.clear"); |
62 | 63 |
63 protected: | 64 protected: |
64 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) OVERRIDE; | 65 virtual bool RunWithStorage(ExtensionSettingsStorage* storage) OVERRIDE; |
65 }; | 66 }; |
66 | 67 |
67 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_API_H_ | 68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_API_H_ |
OLD | NEW |