OLD | NEW |
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 #include "chrome/browser/extensions/settings/settings_frontend.h" | 5 #include "chrome/browser/extensions/settings/settings_frontend.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "chrome/browser/extensions/event_names.h" | 13 #include "chrome/browser/extensions/event_names.h" |
14 #include "chrome/browser/extensions/event_router.h" | 14 #include "chrome/browser/extensions/event_router.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" |
16 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" | 17 #include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" |
17 #include "chrome/browser/extensions/settings/settings_backend.h" | 18 #include "chrome/browser/extensions/settings/settings_backend.h" |
18 #include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h" | 19 #include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/extensions/api/storage.h" | 21 #include "chrome/common/extensions/api/storage.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 | 23 |
23 #if defined(ENABLE_CONFIGURATION_POLICY) | 24 #if defined(ENABLE_CONFIGURATION_POLICY) |
24 #include "chrome/browser/extensions/settings/managed_value_store_cache.h" | 25 #include "chrome/browser/extensions/settings/managed_value_store_cache.h" |
25 #endif | 26 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
40 virtual void OnSettingsChanged( | 41 virtual void OnSettingsChanged( |
41 const std::string& extension_id, | 42 const std::string& extension_id, |
42 settings_namespace::Namespace settings_namespace, | 43 settings_namespace::Namespace settings_namespace, |
43 const std::string& change_json) OVERRIDE { | 44 const std::string& change_json) OVERRIDE { |
44 // TODO(gdk): This is a temporary hack while the refactoring for | 45 // TODO(gdk): This is a temporary hack while the refactoring for |
45 // string-based event payloads is removed. http://crbug.com/136045 | 46 // string-based event payloads is removed. http://crbug.com/136045 |
46 scoped_ptr<ListValue> args(new ListValue()); | 47 scoped_ptr<ListValue> args(new ListValue()); |
47 args->Append(base::JSONReader::Read(change_json)); | 48 args->Append(base::JSONReader::Read(change_json)); |
48 args->Append(Value::CreateStringValue(settings_namespace::ToString( | 49 args->Append(Value::CreateStringValue(settings_namespace::ToString( |
49 settings_namespace))); | 50 settings_namespace))); |
50 | 51 extensions::ExtensionSystem::Get(profile_)->event_router()-> |
51 profile_->GetExtensionEventRouter()->DispatchEventToExtension( | 52 DispatchEventToExtension(extension_id, event_names::kOnSettingsChanged, |
52 extension_id, event_names::kOnSettingsChanged, args.Pass(), NULL, | 53 args.Pass(), NULL, GURL()); |
53 GURL()); | |
54 } | 54 } |
55 | 55 |
56 private: | 56 private: |
57 Profile* const profile_; | 57 Profile* const profile_; |
58 }; | 58 }; |
59 | 59 |
60 SettingsStorageQuotaEnforcer::Limits GetLocalLimits() { | 60 SettingsStorageQuotaEnforcer::Limits GetLocalLimits() { |
61 SettingsStorageQuotaEnforcer::Limits limits = { | 61 SettingsStorageQuotaEnforcer::Limits limits = { |
62 static_cast<size_t>(api::storage::local::QUOTA_BYTES), | 62 static_cast<size_t>(api::storage::local::QUOTA_BYTES), |
63 std::numeric_limits<size_t>::max(), | 63 std::numeric_limits<size_t>::max(), |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 CacheMap::iterator it = caches_.find(settings_namespace); | 204 CacheMap::iterator it = caches_.find(settings_namespace); |
205 if (it != caches_.end()) { | 205 if (it != caches_.end()) { |
206 ValueStoreCache* cache = it->second; | 206 ValueStoreCache* cache = it->second; |
207 cache->ShutdownOnUI(); | 207 cache->ShutdownOnUI(); |
208 cache->GetMessageLoop()->DeleteSoon(FROM_HERE, cache); | 208 cache->GetMessageLoop()->DeleteSoon(FROM_HERE, cache); |
209 caches_.erase(it); | 209 caches_.erase(it); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 } // namespace extensions | 213 } // namespace extensions |
OLD | NEW |