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 30 matching lines...) Expand all Loading... |
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(events::STORAGE_ON_CHANGED, | 50 scoped_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED, |
51 core_api::storage::OnChanged::kEventName, | 51 api::storage::OnChanged::kEventName, |
52 args.Pass())); | 52 args.Pass())); |
53 EventRouter::Get(browser_context_) | 53 EventRouter::Get(browser_context_) |
54 ->DispatchEventToExtension(extension_id, event.Pass()); | 54 ->DispatchEventToExtension(extension_id, event.Pass()); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 BrowserContext* const browser_context_; | 58 BrowserContext* const browser_context_; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace | 61 } // namespace |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // static | 177 // static |
178 BrowserContextKeyedAPIFactory<StorageFrontend>* | 178 BrowserContextKeyedAPIFactory<StorageFrontend>* |
179 StorageFrontend::GetFactoryInstance() { | 179 StorageFrontend::GetFactoryInstance() { |
180 return g_factory.Pointer(); | 180 return g_factory.Pointer(); |
181 } | 181 } |
182 | 182 |
183 // static | 183 // static |
184 const char* StorageFrontend::service_name() { return "StorageFrontend"; } | 184 const char* StorageFrontend::service_name() { return "StorageFrontend"; } |
185 | 185 |
186 } // namespace extensions | 186 } // namespace extensions |
OLD | NEW |