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/api/storage/settings_frontend.h" | 5 #include "chrome/browser/extensions/api/storage/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 26 matching lines...) Expand all Loading... |
37 public: | 37 public: |
38 explicit DefaultObserver(Profile* profile) : profile_(profile) {} | 38 explicit DefaultObserver(Profile* profile) : profile_(profile) {} |
39 | 39 |
40 // SettingsObserver implementation. | 40 // SettingsObserver implementation. |
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<base::ListValue> args(new base::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 scoped_ptr<Event> event(new Event( | 51 scoped_ptr<Event> event(new Event( |
52 event_names::kOnSettingsChanged, args.Pass())); | 52 event_names::kOnSettingsChanged, args.Pass())); |
53 ExtensionSystem::Get(profile_)->event_router()-> | 53 ExtensionSystem::Get(profile_)->event_router()-> |
54 DispatchEventToExtension(extension_id, event.Pass()); | 54 DispatchEventToExtension(extension_id, event.Pass()); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 CacheMap::iterator it = caches_.find(settings_namespace); | 207 CacheMap::iterator it = caches_.find(settings_namespace); |
208 if (it != caches_.end()) { | 208 if (it != caches_.end()) { |
209 ValueStoreCache* cache = it->second; | 209 ValueStoreCache* cache = it->second; |
210 cache->ShutdownOnUI(); | 210 cache->ShutdownOnUI(); |
211 BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, cache); | 211 BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, cache); |
212 caches_.erase(it); | 212 caches_.erase(it); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 } // namespace extensions | 216 } // namespace extensions |
OLD | NEW |