OLD | NEW |
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 Loading... |
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 Loading... |
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(¶ms); | 113 chrome::Navigate(¶ms); |
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 |
OLD | NEW |