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

Side by Side Diff: chrome/browser/ui/ash/cast_config_delegate_chromeos.cc

Issue 1567103005: Replace base::CallbackList with base::ObserverList in CastConfigDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Replace with ObserverList instead of base::Callback Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/ash/cast_config_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 CastConfigDelegateChromeos::CastConfigDelegateChromeos() { 58 CastConfigDelegateChromeos::CastConfigDelegateChromeos() {
59 } 59 }
60 60
61 CastConfigDelegateChromeos::~CastConfigDelegateChromeos() { 61 CastConfigDelegateChromeos::~CastConfigDelegateChromeos() {
62 } 62 }
63 63
64 bool CastConfigDelegateChromeos::HasCastExtension() const { 64 bool CastConfigDelegateChromeos::HasCastExtension() const {
65 return FindCastExtension() != nullptr; 65 return FindCastExtension() != nullptr;
66 } 66 }
67 67
68 CastConfigDelegateChromeos::DeviceUpdateSubscription 68 void CastConfigDelegateChromeos::AddObserver(
69 CastConfigDelegateChromeos::RegisterDeviceUpdateObserver( 69 ash::CastConfigDelegate::Observer* observer) {
70 const ReceiversAndActivitesCallback& callback) {
71 auto listeners = extensions::CastDeviceUpdateListeners::Get(GetProfile()); 70 auto listeners = extensions::CastDeviceUpdateListeners::Get(GetProfile());
72 return listeners->RegisterCallback(callback); 71 return listeners->AddObserver(observer);
stevenjb 2016/01/12 23:31:50 nit: Local is unnecessary
jdufault 2016/01/12 23:59:22 Done.
72 }
73 void CastConfigDelegateChromeos::RemoveObserver(
74 ash::CastConfigDelegate::Observer* observer) {
75 auto listeners = extensions::CastDeviceUpdateListeners::Get(GetProfile());
76 return listeners->RemoveObserver(observer);
stevenjb 2016/01/12 23:31:50 Local unnecessary
jdufault 2016/01/12 23:59:22 Done.
73 } 77 }
74 78
75 void CastConfigDelegateChromeos::RequestDeviceRefresh() { 79 void CastConfigDelegateChromeos::RequestDeviceRefresh() {
76 scoped_ptr<base::ListValue> args = 80 scoped_ptr<base::ListValue> args =
77 extensions::api::cast_devices_private::UpdateDevicesRequested::Create(); 81 extensions::api::cast_devices_private::UpdateDevicesRequested::Create();
78 scoped_ptr<extensions::Event> event(new extensions::Event( 82 scoped_ptr<extensions::Event> event(new extensions::Event(
79 extensions::events::CAST_DEVICES_PRIVATE_ON_UPDATE_DEVICES_REQUESTED, 83 extensions::events::CAST_DEVICES_PRIVATE_ON_UPDATE_DEVICES_REQUESTED,
80 extensions::api::cast_devices_private::UpdateDevicesRequested::kEventName, 84 extensions::api::cast_devices_private::UpdateDevicesRequested::kEventName,
81 std::move(args))); 85 std::move(args)));
82 extensions::EventRouter::Get(GetProfile()) 86 extensions::EventRouter::Get(GetProfile())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 chrome::NavigateParams params( 118 chrome::NavigateParams params(
115 ProfileManager::GetActiveUserProfile(), 119 ProfileManager::GetActiveUserProfile(),
116 FindCastExtension()->GetResourceURL("options.html"), 120 FindCastExtension()->GetResourceURL("options.html"),
117 ui::PAGE_TRANSITION_LINK); 121 ui::PAGE_TRANSITION_LINK);
118 params.disposition = NEW_FOREGROUND_TAB; 122 params.disposition = NEW_FOREGROUND_TAB;
119 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 123 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
120 chrome::Navigate(&params); 124 chrome::Navigate(&params);
121 } 125 }
122 126
123 } // namespace chromeos 127 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698