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

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: Add TODO for proper fix 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
69 CastConfigDelegateChromeos::RegisterDeviceUpdateObserver(
70 const ReceiversAndActivitesCallback& callback) {
71 auto listeners = extensions::CastDeviceUpdateListeners::Get(GetProfile());
72 return listeners->RegisterCallback(callback);
73 }
74
75 void CastConfigDelegateChromeos::RequestDeviceRefresh() { 68 void CastConfigDelegateChromeos::RequestDeviceRefresh() {
76 scoped_ptr<base::ListValue> args = 69 scoped_ptr<base::ListValue> args =
77 extensions::api::cast_devices_private::UpdateDevicesRequested::Create(); 70 extensions::api::cast_devices_private::UpdateDevicesRequested::Create();
78 scoped_ptr<extensions::Event> event(new extensions::Event( 71 scoped_ptr<extensions::Event> event(new extensions::Event(
79 extensions::events::CAST_DEVICES_PRIVATE_ON_UPDATE_DEVICES_REQUESTED, 72 extensions::events::CAST_DEVICES_PRIVATE_ON_UPDATE_DEVICES_REQUESTED,
80 extensions::api::cast_devices_private::UpdateDevicesRequested::kEventName, 73 extensions::api::cast_devices_private::UpdateDevicesRequested::kEventName,
81 std::move(args))); 74 std::move(args)));
82 extensions::EventRouter::Get(GetProfile()) 75 extensions::EventRouter::Get(GetProfile())
83 ->DispatchEventToExtension(FindCastExtension()->id(), std::move(event)); 76 ->DispatchEventToExtension(FindCastExtension()->id(), std::move(event));
84 } 77 }
(...skipping 28 matching lines...) Expand all
113 void CastConfigDelegateChromeos::LaunchCastOptions() { 106 void CastConfigDelegateChromeos::LaunchCastOptions() {
114 chrome::NavigateParams params( 107 chrome::NavigateParams params(
115 ProfileManager::GetActiveUserProfile(), 108 ProfileManager::GetActiveUserProfile(),
116 FindCastExtension()->GetResourceURL("options.html"), 109 FindCastExtension()->GetResourceURL("options.html"),
117 ui::PAGE_TRANSITION_LINK); 110 ui::PAGE_TRANSITION_LINK);
118 params.disposition = NEW_FOREGROUND_TAB; 111 params.disposition = NEW_FOREGROUND_TAB;
119 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 112 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
120 chrome::Navigate(&params); 113 chrome::Navigate(&params);
121 } 114 }
122 115
116 void CastConfigDelegateChromeos::AddObserver(
117 ash::CastConfigDelegate::Observer* observer) {
118 return extensions::CastDeviceUpdateListeners::Get(GetProfile())
119 ->AddObserver(observer);
120 }
121
122 void CastConfigDelegateChromeos::RemoveObserver(
123 ash::CastConfigDelegate::Observer* observer) {
124 return extensions::CastDeviceUpdateListeners::Get(GetProfile())
125 ->RemoveObserver(observer);
126 }
127
123 } // namespace chromeos 128 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/cast_config_delegate_chromeos.h ('k') | chrome/browser/ui/ash/cast_config_delegate_media_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698