| 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" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 virtual void OnSettingsChanged( | 41 virtual void OnSettingsChanged( |
| 42 const std::string& extension_id, | 42 const std::string& extension_id, |
| 43 settings_namespace::Namespace settings_namespace, | 43 settings_namespace::Namespace settings_namespace, |
| 44 const std::string& change_json) OVERRIDE { | 44 const std::string& change_json) OVERRIDE { |
| 45 // TODO(gdk): This is a temporary hack while the refactoring for | 45 // TODO(gdk): This is a temporary hack while the refactoring for |
| 46 // string-based event payloads is removed. http://crbug.com/136045 | 46 // string-based event payloads is removed. http://crbug.com/136045 |
| 47 scoped_ptr<ListValue> args(new ListValue()); | 47 scoped_ptr<ListValue> args(new ListValue()); |
| 48 args->Append(base::JSONReader::Read(change_json)); | 48 args->Append(base::JSONReader::Read(change_json)); |
| 49 args->Append(Value::CreateStringValue(settings_namespace::ToString( | 49 args->Append(Value::CreateStringValue(settings_namespace::ToString( |
| 50 settings_namespace))); | 50 settings_namespace))); |
| 51 extensions::ExtensionSystem::Get(profile_)->event_router()-> | 51 scoped_ptr<Event> event(new Event( |
| 52 DispatchEventToExtension(extension_id, event_names::kOnSettingsChanged, | 52 event_names::kOnSettingsChanged, args.Pass())); |
| 53 args.Pass(), NULL, GURL()); | 53 ExtensionSystem::Get(profile_)->event_router()-> |
| 54 DispatchEventToExtension(extension_id, event.Pass()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 Profile* const profile_; | 58 Profile* const profile_; |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 SettingsStorageQuotaEnforcer::Limits GetLocalLimits() { | 61 SettingsStorageQuotaEnforcer::Limits GetLocalLimits() { |
| 61 SettingsStorageQuotaEnforcer::Limits limits = { | 62 SettingsStorageQuotaEnforcer::Limits limits = { |
| 62 static_cast<size_t>(api::storage::local::QUOTA_BYTES), | 63 static_cast<size_t>(api::storage::local::QUOTA_BYTES), |
| 63 std::numeric_limits<size_t>::max(), | 64 std::numeric_limits<size_t>::max(), |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 CacheMap::iterator it = caches_.find(settings_namespace); | 206 CacheMap::iterator it = caches_.find(settings_namespace); |
| 206 if (it != caches_.end()) { | 207 if (it != caches_.end()) { |
| 207 ValueStoreCache* cache = it->second; | 208 ValueStoreCache* cache = it->second; |
| 208 cache->ShutdownOnUI(); | 209 cache->ShutdownOnUI(); |
| 209 cache->GetMessageLoop()->DeleteSoon(FROM_HERE, cache); | 210 cache->GetMessageLoop()->DeleteSoon(FROM_HERE, cache); |
| 210 caches_.erase(it); | 211 caches_.erase(it); |
| 211 } | 212 } |
| 212 } | 213 } |
| 213 | 214 |
| 214 } // namespace extensions | 215 } // namespace extensions |
| OLD | NEW |