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

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

Issue 2489723005: chromeos: Make system tray audio item observe CrasAudioHandler directly (Closed)
Patch Set: rebase Created 4 years, 1 month 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/ui/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 input_method::InputMethodManager::Get()->AddObserver(this); 185 input_method::InputMethodManager::Get()->AddObserver(this);
186 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); 186 input_method::InputMethodManager::Get()->AddImeMenuObserver(this);
187 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); 187 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this);
188 188
189 device::BluetoothAdapterFactory::GetAdapter( 189 device::BluetoothAdapterFactory::GetAdapter(
190 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, 190 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady,
191 weak_ptr_factory_.GetWeakPtr())); 191 weak_ptr_factory_.GetWeakPtr()));
192 192
193 ash::WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); 193 ash::WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this);
194 194
195 if (CrasAudioHandler::IsInitialized())
196 CrasAudioHandler::Get()->AddAudioObserver(this);
197
198 BrowserList::AddObserver(this); 195 BrowserList::AddObserver(this);
199 } 196 }
200 197
201 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( 198 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady(
202 scoped_refptr<device::BluetoothAdapter> adapter) { 199 scoped_refptr<device::BluetoothAdapter> adapter) {
203 bluetooth_adapter_ = adapter; 200 bluetooth_adapter_ = adapter;
204 CHECK(bluetooth_adapter_); 201 CHECK(bluetooth_adapter_);
205 bluetooth_adapter_->AddObserver(this); 202 bluetooth_adapter_->AddObserver(this);
206 203
207 local_state_registrar_.reset(new PrefChangeRegistrar); 204 local_state_registrar_.reset(new PrefChangeRegistrar);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 accessibility_subscription_.reset(); 237 accessibility_subscription_.reset();
241 238
242 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 239 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
243 input_method::InputMethodManager::Get()->RemoveObserver(this); 240 input_method::InputMethodManager::Get()->RemoveObserver(this);
244 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); 241 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this);
245 if (bluetooth_adapter_) 242 if (bluetooth_adapter_)
246 bluetooth_adapter_->RemoveObserver(this); 243 bluetooth_adapter_->RemoveObserver(this);
247 ash::WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver( 244 ash::WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(
248 this); 245 this);
249 246
250 if (CrasAudioHandler::IsInitialized())
251 CrasAudioHandler::Get()->RemoveAudioObserver(this);
252
253 BrowserList::RemoveObserver(this); 247 BrowserList::RemoveObserver(this);
254 StopObservingAppWindowRegistry(); 248 StopObservingAppWindowRegistry();
255 StopObservingCustodianInfoChanges(); 249 StopObservingCustodianInfoChanges();
256 250
257 policy::BrowserPolicyConnectorChromeOS* connector = 251 policy::BrowserPolicyConnectorChromeOS* connector =
258 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 252 g_browser_process->platform_part()->browser_policy_connector_chromeos();
259 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = 253 policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
260 connector->GetDeviceCloudPolicyManager(); 254 connector->GetDeviceCloudPolicyManager();
261 if (policy_manager) 255 if (policy_manager)
262 policy_manager->core()->store()->RemoveObserver(this); 256 policy_manager->core()->store()->RemoveObserver(this);
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 bool show_message) { 867 bool show_message) {
874 GetSystemTrayNotifier()->NotifyRefreshIME(); 868 GetSystemTrayNotifier()->NotifyRefreshIME();
875 } 869 }
876 870
877 // Overridden from InputMethodMenuManager::Observer. 871 // Overridden from InputMethodMenuManager::Observer.
878 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( 872 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged(
879 ui::ime::InputMethodMenuManager* manager) { 873 ui::ime::InputMethodMenuManager* manager) {
880 GetSystemTrayNotifier()->NotifyRefreshIME(); 874 GetSystemTrayNotifier()->NotifyRefreshIME();
881 } 875 }
882 876
883 // Overridden from CrasAudioHandler::AudioObserver.
884 void SystemTrayDelegateChromeOS::OnOutputNodeVolumeChanged(uint64_t node_id,
885 int volume) {
886 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(node_id, volume);
887 }
888
889 void SystemTrayDelegateChromeOS::OnOutputMuteChanged(bool mute_on,
890 bool system_adjust) {
891 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(mute_on, system_adjust);
892 }
893
894 void SystemTrayDelegateChromeOS::OnInputNodeGainChanged(uint64_t /* node_id */,
895 int /* gain */) {
896 }
897
898 void SystemTrayDelegateChromeOS::OnInputMuteChanged(bool /* mute_on */) {
899 }
900
901 void SystemTrayDelegateChromeOS::OnAudioNodesChanged() {
902 GetSystemTrayNotifier()->NotifyAudioNodesChanged();
903 }
904
905 void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() {
906 GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged();
907 }
908
909 void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() {
910 GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged();
911 }
912
913 // Overridden from BluetoothAdapter::Observer. 877 // Overridden from BluetoothAdapter::Observer.
914 void SystemTrayDelegateChromeOS::AdapterPresentChanged( 878 void SystemTrayDelegateChromeOS::AdapterPresentChanged(
915 device::BluetoothAdapter* adapter, 879 device::BluetoothAdapter* adapter,
916 bool present) { 880 bool present) {
917 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); 881 GetSystemTrayNotifier()->NotifyRefreshBluetooth();
918 } 882 }
919 883
920 void SystemTrayDelegateChromeOS::AdapterPoweredChanged( 884 void SystemTrayDelegateChromeOS::AdapterPoweredChanged(
921 device::BluetoothAdapter* adapter, 885 device::BluetoothAdapter* adapter,
922 bool powered) { 886 bool powered) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1031 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1068 << "ENABLE_SUPERVISED_USERS undefined."; 1032 << "ENABLE_SUPERVISED_USERS undefined.";
1069 return base::string16(); 1033 return base::string16();
1070 } 1034 }
1071 1035
1072 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1036 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1073 return new SystemTrayDelegateChromeOS(); 1037 return new SystemTrayDelegateChromeOS();
1074 } 1038 }
1075 1039
1076 } // namespace chromeos 1040 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | components/arc/audio/arc_audio_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698