OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/storage/storage_frontend.h" | 5 #include "extensions/browser/api/storage/storage_frontend.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // SettingsObserver implementation. | 40 // SettingsObserver implementation. |
41 void OnSettingsChanged(const std::string& extension_id, | 41 void OnSettingsChanged(const std::string& extension_id, |
42 settings_namespace::Namespace settings_namespace, | 42 settings_namespace::Namespace settings_namespace, |
43 const std::string& change_json) override { | 43 const std::string& change_json) override { |
44 // TODO(gdk): This is a temporary hack while the refactoring for | 44 // TODO(gdk): This is a temporary hack while the refactoring for |
45 // string-based event payloads is removed. http://crbug.com/136045 | 45 // string-based event payloads is removed. http://crbug.com/136045 |
46 scoped_ptr<base::ListValue> args(new base::ListValue()); | 46 scoped_ptr<base::ListValue> args(new base::ListValue()); |
47 args->Append(base::JSONReader::Read(change_json)); | 47 args->Append(base::JSONReader::Read(change_json)); |
48 args->Append(new base::StringValue(settings_namespace::ToString( | 48 args->Append(new base::StringValue(settings_namespace::ToString( |
49 settings_namespace))); | 49 settings_namespace))); |
50 scoped_ptr<Event> event(new Event( | 50 scoped_ptr<Event> event(new Event(events::UNKNOWN, |
51 core_api::storage::OnChanged::kEventName, args.Pass())); | 51 core_api::storage::OnChanged::kEventName, |
| 52 args.Pass())); |
52 EventRouter::Get(browser_context_) | 53 EventRouter::Get(browser_context_) |
53 ->DispatchEventToExtension(extension_id, event.Pass()); | 54 ->DispatchEventToExtension(extension_id, event.Pass()); |
54 } | 55 } |
55 | 56 |
56 private: | 57 private: |
57 BrowserContext* const browser_context_; | 58 BrowserContext* const browser_context_; |
58 }; | 59 }; |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // static | 177 // static |
177 BrowserContextKeyedAPIFactory<StorageFrontend>* | 178 BrowserContextKeyedAPIFactory<StorageFrontend>* |
178 StorageFrontend::GetFactoryInstance() { | 179 StorageFrontend::GetFactoryInstance() { |
179 return g_factory.Pointer(); | 180 return g_factory.Pointer(); |
180 } | 181 } |
181 | 182 |
182 // static | 183 // static |
183 const char* StorageFrontend::service_name() { return "StorageFrontend"; } | 184 const char* StorageFrontend::service_name() { return "StorageFrontend"; } |
184 | 185 |
185 } // namespace extensions | 186 } // namespace extensions |
OLD | NEW |