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 <utility> | 7 #include <utility> |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 : browser_context_(context) {} | 42 : browser_context_(context) {} |
43 | 43 |
44 // SettingsObserver implementation. | 44 // SettingsObserver implementation. |
45 void OnSettingsChanged(const std::string& extension_id, | 45 void OnSettingsChanged(const std::string& extension_id, |
46 settings_namespace::Namespace settings_namespace, | 46 settings_namespace::Namespace settings_namespace, |
47 const std::string& change_json) override { | 47 const std::string& change_json) override { |
48 // TODO(gdk): This is a temporary hack while the refactoring for | 48 // TODO(gdk): This is a temporary hack while the refactoring for |
49 // string-based event payloads is removed. http://crbug.com/136045 | 49 // string-based event payloads is removed. http://crbug.com/136045 |
50 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 50 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
51 args->Append(base::JSONReader::Read(change_json)); | 51 args->Append(base::JSONReader::Read(change_json)); |
52 args->Append(new base::StringValue(settings_namespace::ToString( | 52 args->AppendString(settings_namespace::ToString(settings_namespace)); |
53 settings_namespace))); | |
54 std::unique_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED, | 53 std::unique_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED, |
55 api::storage::OnChanged::kEventName, | 54 api::storage::OnChanged::kEventName, |
56 std::move(args))); | 55 std::move(args))); |
57 EventRouter::Get(browser_context_) | 56 EventRouter::Get(browser_context_) |
58 ->DispatchEventToExtension(extension_id, std::move(event)); | 57 ->DispatchEventToExtension(extension_id, std::move(event)); |
59 } | 58 } |
60 | 59 |
61 private: | 60 private: |
62 BrowserContext* const browser_context_; | 61 BrowserContext* const browser_context_; |
63 }; | 62 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // static | 177 // static |
179 BrowserContextKeyedAPIFactory<StorageFrontend>* | 178 BrowserContextKeyedAPIFactory<StorageFrontend>* |
180 StorageFrontend::GetFactoryInstance() { | 179 StorageFrontend::GetFactoryInstance() { |
181 return g_factory.Pointer(); | 180 return g_factory.Pointer(); |
182 } | 181 } |
183 | 182 |
184 // static | 183 // static |
185 const char* StorageFrontend::service_name() { return "StorageFrontend"; } | 184 const char* StorageFrontend::service_name() { return "StorageFrontend"; } |
186 | 185 |
187 } // namespace extensions | 186 } // namespace extensions |
OLD | NEW |