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

Side by Side Diff: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc

Issue 2898383002: [Extensions] Make Event::restrict_to_browser_context const. (Closed)
Patch Set: sync @tott Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.h" 5 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 std::vector<api::signed_in_devices::DeviceInfo> args; 69 std::vector<api::signed_in_devices::DeviceInfo> args;
70 for (const std::unique_ptr<DeviceInfo>& info : devices) { 70 for (const std::unique_ptr<DeviceInfo>& info : devices) {
71 api::signed_in_devices::DeviceInfo api_device; 71 api::signed_in_devices::DeviceInfo api_device;
72 FillDeviceInfo(*info, &api_device); 72 FillDeviceInfo(*info, &api_device);
73 args.push_back(std::move(api_device)); 73 args.push_back(std::move(api_device));
74 } 74 }
75 75
76 std::unique_ptr<base::ListValue> result = 76 std::unique_ptr<base::ListValue> result =
77 api::signed_in_devices::OnDeviceInfoChange::Create(args); 77 api::signed_in_devices::OnDeviceInfoChange::Create(args);
78 std::unique_ptr<Event> event( 78 auto event = base::MakeUnique<Event>(
79 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, 79 events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE,
80 api::signed_in_devices::OnDeviceInfoChange::kEventName, 80 api::signed_in_devices::OnDeviceInfoChange::kEventName, std::move(result),
81 std::move(result))); 81 profile_);
82
83 event->restrict_to_browser_context = profile_;
84 82
85 EventRouter::Get(profile_) 83 EventRouter::Get(profile_)
86 ->DispatchEventToExtension(extension_id_, std::move(event)); 84 ->DispatchEventToExtension(extension_id_, std::move(event));
87 } 85 }
88 86
89 static base::LazyInstance< 87 static base::LazyInstance<
90 BrowserContextKeyedAPIFactory<SignedInDevicesManager>>::DestructorAtExit 88 BrowserContextKeyedAPIFactory<SignedInDevicesManager>>::DestructorAtExit
91 g_factory = LAZY_INSTANCE_INITIALIZER; 89 g_factory = LAZY_INSTANCE_INITIALIZER;
92 90
93 // static 91 // static
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 154 }
157 155
158 void SignedInDevicesManager::OnExtensionUnloaded( 156 void SignedInDevicesManager::OnExtensionUnloaded(
159 content::BrowserContext* browser_context, 157 content::BrowserContext* browser_context,
160 const Extension* extension, 158 const Extension* extension,
161 UnloadedExtensionReason reason) { 159 UnloadedExtensionReason reason) {
162 RemoveChangeObserverForExtension(extension->id()); 160 RemoveChangeObserverForExtension(extension->id());
163 } 161 }
164 162
165 } // namespace extensions 163 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698