Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: extensions/browser/api/storage/storage_frontend.cc

Issue 2037703004: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/settings_test_util.cc ('k') | extensions/browser/api/web_request/upload_data_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698