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

Side by Side Diff: chrome/browser/extensions/settings/settings_frontend.h

Issue 9284013: Extension Storage API: expose storage quota information to extensions, via: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 11 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
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_SETTINGS_SETTINGS_FRONTEND_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list_threadsafe.h" 15 #include "base/observer_list_threadsafe.h"
16 #include "chrome/browser/extensions/settings/settings_leveldb_storage.h" 16 #include "chrome/browser/extensions/settings/settings_leveldb_storage.h"
17 #include "chrome/browser/extensions/settings/settings_namespace.h" 17 #include "chrome/browser/extensions/settings/settings_namespace.h"
18 #include "chrome/browser/extensions/settings/settings_observer.h" 18 #include "chrome/browser/extensions/settings/settings_observer.h"
19 #include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h"
19 #include "chrome/browser/sync/api/syncable_service.h" 20 #include "chrome/browser/sync/api/syncable_service.h"
20 21
21 class Profile; 22 class Profile;
22 23
23 namespace extensions { 24 namespace extensions {
24 25
25 class SettingsStorage; 26 class SettingsStorage;
26 27
27 // The component of extension settings which runs on the UI thread, as opposed 28 // The component of extension settings which runs on the UI thread, as opposed
28 // to SettingsBackend which lives on the FILE thread. 29 // to SettingsBackend which lives on the FILE thread.
29 // All public methods must be called on the UI thread. 30 // All public methods must be called on the UI thread.
30 class SettingsFrontend { 31 class SettingsFrontend {
31 public: 32 public:
32 // Creates with the default factory. Ownership of |profile| not taken. 33 // Quota limits for sync and local. Make these public for tests.
34 static const SettingsStorageQuotaEnforcer::Limits kSyncQuota;
35 static const SettingsStorageQuotaEnforcer::Limits kLocalQuota;
36
37 // Creates with the default factory. Ownership of |profile| not taken.
33 static SettingsFrontend* Create(Profile* profile); 38 static SettingsFrontend* Create(Profile* profile);
34 39
40 // Creates with a specific factory |storage_factory| (presumably for tests).
41 // Ownership of |profile| not taken.
35 static SettingsFrontend* Create( 42 static SettingsFrontend* Create(
36 const scoped_refptr<SettingsStorageFactory>& storage_factory, 43 const scoped_refptr<SettingsStorageFactory>& storage_factory,
37 // Owership NOT taken. 44 // Owership NOT taken.
38 Profile* profile); 45 Profile* profile);
39 46
40 virtual ~SettingsFrontend(); 47 virtual ~SettingsFrontend();
41 48
42 typedef base::Callback<void(SyncableService*)> SyncableServiceCallback; 49 typedef base::Callback<void(SyncableService*)> SyncableServiceCallback;
43 typedef base::Callback<void(SettingsStorage*)> StorageCallback; 50 typedef base::Callback<void(SettingsStorage*)> StorageCallback;
44 51
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 scoped_refptr<BackendWrapper> extension; 96 scoped_refptr<BackendWrapper> extension;
90 }; 97 };
91 std::map<settings_namespace::Namespace, BackendWrappers> backends_; 98 std::map<settings_namespace::Namespace, BackendWrappers> backends_;
92 99
93 DISALLOW_COPY_AND_ASSIGN(SettingsFrontend); 100 DISALLOW_COPY_AND_ASSIGN(SettingsFrontend);
94 }; 101 };
95 102
96 } // namespace extensions 103 } // namespace extensions
97 104
98 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_ 105 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698