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

Side by Side Diff: chrome/browser/extensions/extension_settings_ui_wrapper.h

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Sync to tip. Latest comments. Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_UI_WRAPPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_UI_WRAPPER_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/callback.h"
12 #include "chrome/browser/sync/api/syncable_service.h"
13
14 class FilePath;
15 class ExtensionSettings;
16 class ExtensionSettingsStorage;
17
18 // Wrapper for an ExtensionSettings object for dealing with thread ownership.
19 // This class lives on the UI thread while ExtensionSettings object live on
20 // the FILE thread.
21 class ExtensionSettingsUIWrapper {
22 public:
23 explicit ExtensionSettingsUIWrapper(const FilePath& base_path);
24
25 typedef base::Callback<void(ExtensionSettings*)> SettingsCallback;
26
27 // Runs |callback| on the FILE thread with the extension settings.
28 void RunWithSettings(const SettingsCallback& callback);
29
30 ~ExtensionSettingsUIWrapper();
31
32 private:
33 // Ref-counted container for the ExtensionSettings object.
34 class Core : public base::RefCountedThreadSafe<Core> {
35 public:
36 // Constructed on UI thread.
37 explicit Core(const FilePath& base_path);
38
39 // Runs |callback| with extension settings.
40 void RunWithSettingsOnFileThread(const SettingsCallback& callback);
41
42 private:
43 // Can be destroyed on either the UI or FILE thread.
44 virtual ~Core();
45 friend class base::RefCountedThreadSafe<Core>;
46
47 // Does any FILE thread specific initialization, such as construction of
48 // |extension_settings_|.
49 void InitOnFileThread(const FilePath& base_path);
50
51 // Lives on the FILE thread.
52 ExtensionSettings* extension_settings_;
53
54 DISALLOW_COPY_AND_ASSIGN(Core);
55 };
56
57 scoped_refptr<Core> core_;
58
59 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIWrapper);
60 };
61
62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_UI_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698