| 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 21 matching lines...) Expand all Loading... |
| 32 // processes for |context| and its incognito partner if it exists. | 32 // processes for |context| and its incognito partner if it exists. |
| 33 class DefaultObserver : public SettingsObserver { | 33 class DefaultObserver : public SettingsObserver { |
| 34 public: | 34 public: |
| 35 explicit DefaultObserver(BrowserContext* context) | 35 explicit DefaultObserver(BrowserContext* context) |
| 36 : browser_context_(context) {} | 36 : browser_context_(context) {} |
| 37 | 37 |
| 38 // SettingsObserver implementation. | 38 // SettingsObserver implementation. |
| 39 virtual void OnSettingsChanged( | 39 virtual void OnSettingsChanged( |
| 40 const std::string& extension_id, | 40 const std::string& extension_id, |
| 41 settings_namespace::Namespace settings_namespace, | 41 settings_namespace::Namespace settings_namespace, |
| 42 const std::string& change_json) OVERRIDE { | 42 const std::string& change_json) override { |
| 43 // TODO(gdk): This is a temporary hack while the refactoring for | 43 // TODO(gdk): This is a temporary hack while the refactoring for |
| 44 // string-based event payloads is removed. http://crbug.com/136045 | 44 // string-based event payloads is removed. http://crbug.com/136045 |
| 45 scoped_ptr<base::ListValue> args(new base::ListValue()); | 45 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 46 args->Append(base::JSONReader::Read(change_json)); | 46 args->Append(base::JSONReader::Read(change_json)); |
| 47 args->Append(new base::StringValue(settings_namespace::ToString( | 47 args->Append(new base::StringValue(settings_namespace::ToString( |
| 48 settings_namespace))); | 48 settings_namespace))); |
| 49 scoped_ptr<Event> event(new Event( | 49 scoped_ptr<Event> event(new Event( |
| 50 core_api::storage::OnChanged::kEventName, args.Pass())); | 50 core_api::storage::OnChanged::kEventName, args.Pass())); |
| 51 EventRouter::Get(browser_context_) | 51 EventRouter::Get(browser_context_) |
| 52 ->DispatchEventToExtension(extension_id, event.Pass()); | 52 ->DispatchEventToExtension(extension_id, event.Pass()); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // static | 172 // static |
| 173 BrowserContextKeyedAPIFactory<StorageFrontend>* | 173 BrowserContextKeyedAPIFactory<StorageFrontend>* |
| 174 StorageFrontend::GetFactoryInstance() { | 174 StorageFrontend::GetFactoryInstance() { |
| 175 return g_factory.Pointer(); | 175 return g_factory.Pointer(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // static | 178 // static |
| 179 const char* StorageFrontend::service_name() { return "StorageFrontend"; } | 179 const char* StorageFrontend::service_name() { return "StorageFrontend"; } |
| 180 | 180 |
| 181 } // namespace extensions | 181 } // namespace extensions |
| OLD | NEW |