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

Side by Side Diff: extensions/browser/api/management/management_api.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/management/management_api.h" 5 #include "extensions/browser/api/management/management_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 858 }
859 859
860 void ManagementEventRouter::BroadcastEvent( 860 void ManagementEventRouter::BroadcastEvent(
861 const Extension* extension, 861 const Extension* extension,
862 events::HistogramValue histogram_value, 862 events::HistogramValue histogram_value,
863 const char* event_name) { 863 const char* event_name) {
864 if (extension->ShouldNotBeVisible()) 864 if (extension->ShouldNotBeVisible())
865 return; // Don't dispatch events for built-in extenions. 865 return; // Don't dispatch events for built-in extenions.
866 std::unique_ptr<base::ListValue> args(new base::ListValue()); 866 std::unique_ptr<base::ListValue> args(new base::ListValue());
867 if (event_name == management::OnUninstalled::kEventName) { 867 if (event_name == management::OnUninstalled::kEventName) {
868 args->Append(new base::StringValue(extension->id())); 868 args->AppendString(extension->id());
869 } else { 869 } else {
870 args->Append(CreateExtensionInfo(*extension, browser_context_).ToValue()); 870 args->Append(CreateExtensionInfo(*extension, browser_context_).ToValue());
871 } 871 }
872 872
873 EventRouter::Get(browser_context_) 873 EventRouter::Get(browser_context_)
874 ->BroadcastEvent(std::unique_ptr<Event>( 874 ->BroadcastEvent(std::unique_ptr<Event>(
875 new Event(histogram_value, event_name, std::move(args)))); 875 new Event(histogram_value, event_name, std::move(args))));
876 } 876 }
877 877
878 ManagementAPI::ManagementAPI(content::BrowserContext* context) 878 ManagementAPI::ManagementAPI(content::BrowserContext* context)
(...skipping 21 matching lines...) Expand all
900 ManagementAPI::GetFactoryInstance() { 900 ManagementAPI::GetFactoryInstance() {
901 return g_factory.Pointer(); 901 return g_factory.Pointer();
902 } 902 }
903 903
904 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 904 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
905 management_event_router_.reset(new ManagementEventRouter(browser_context_)); 905 management_event_router_.reset(new ManagementEventRouter(browser_context_));
906 EventRouter::Get(browser_context_)->UnregisterObserver(this); 906 EventRouter::Get(browser_context_)->UnregisterObserver(this);
907 } 907 }
908 908
909 } // namespace extensions 909 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698