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

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

Issue 163953007: Refactor the TrayAudio code so that it can be used by other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak by using scoped_ptr in TrayAudio Created 6 years, 10 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 device::BluetoothAdapterFactory::GetAdapter( 305 device::BluetoothAdapterFactory::GetAdapter(
306 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, 306 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady,
307 weak_ptr_factory_.GetWeakPtr())); 307 weak_ptr_factory_.GetWeakPtr()));
308 308
309 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( 309 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(
310 this); 310 this);
311 311
312 if (LoginState::IsInitialized()) 312 if (LoginState::IsInitialized())
313 LoginState::Get()->AddObserver(this); 313 LoginState::Get()->AddObserver(this);
314
315 if (CrasAudioHandler::IsInitialized())
316 CrasAudioHandler::Get()->AddAudioObserver(this);
314 } 317 }
315 318
316 void SystemTrayDelegateChromeOS::Shutdown() { 319 void SystemTrayDelegateChromeOS::Shutdown() {
317 device_settings_observer_.reset(); 320 device_settings_observer_.reset();
318 } 321 }
319 322
320 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( 323 void SystemTrayDelegateChromeOS::InitializeOnAdapterReady(
321 scoped_refptr<device::BluetoothAdapter> adapter) { 324 scoped_refptr<device::BluetoothAdapter> adapter) {
322 bluetooth_adapter_ = adapter; 325 bluetooth_adapter_ = adapter;
323 CHECK(bluetooth_adapter_.get()); 326 CHECK(bluetooth_adapter_.get());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 361 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
359 input_method::InputMethodManager::Get()->RemoveObserver(this); 362 input_method::InputMethodManager::Get()->RemoveObserver(this);
360 if (SystemKeyEventListener::GetInstance()) 363 if (SystemKeyEventListener::GetInstance())
361 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); 364 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this);
362 bluetooth_adapter_->RemoveObserver(this); 365 bluetooth_adapter_->RemoveObserver(this);
363 ash::Shell::GetInstance() 366 ash::Shell::GetInstance()
364 ->session_state_delegate() 367 ->session_state_delegate()
365 ->RemoveSessionStateObserver(this); 368 ->RemoveSessionStateObserver(this);
366 LoginState::Get()->RemoveObserver(this); 369 LoginState::Get()->RemoveObserver(this);
367 370
368 // Stop observing Drive operations. 371 if (CrasAudioHandler::IsInitialized())
372 CrasAudioHandler::Get()->RemoveAudioObserver(this);
373
374 // Stop observing Drive operations.
369 UnobserveDriveUpdates(); 375 UnobserveDriveUpdates();
370 376
371 policy::BrowserPolicyConnectorChromeOS* connector = 377 policy::BrowserPolicyConnectorChromeOS* connector =
372 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 378 g_browser_process->platform_part()->browser_policy_connector_chromeos();
373 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = 379 policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
374 connector->GetDeviceCloudPolicyManager(); 380 connector->GetDeviceCloudPolicyManager();
375 if (policy_manager) 381 if (policy_manager)
376 policy_manager->core()->store()->RemoveObserver(this); 382 policy_manager->core()->store()->RemoveObserver(this);
377 } 383 }
378 384
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 show_message = false; 1205 show_message = false;
1200 } 1206 }
1201 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); 1207 GetSystemTrayNotifier()->NotifyRefreshIME(show_message);
1202 } 1208 }
1203 1209
1204 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( 1210 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged(
1205 input_method::InputMethodManager* manager) { 1211 input_method::InputMethodManager* manager) {
1206 GetSystemTrayNotifier()->NotifyRefreshIME(false); 1212 GetSystemTrayNotifier()->NotifyRefreshIME(false);
1207 } 1213 }
1208 1214
1215 // Overridden from CrasAudioHandler::AudioObserver.
1216 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() {
1217 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged();
1218 }
1219
1220 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() {
1221 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged();
1222 }
1223
1224 void SystemTrayDelegateChromeOS::OnInputGainChanged() {
1225 }
1226
1227 void SystemTrayDelegateChromeOS::OnInputMuteChanged() {
1228 }
1229
1230 void SystemTrayDelegateChromeOS::OnAudioNodesChanged() {
1231 GetSystemTrayNotifier()->NotifyAudioNodesChanged();
1232 }
1233
1234 void SystemTrayDelegateChromeOS::OnActiveOutputNodeChanged() {
1235 GetSystemTrayNotifier()->NotifyAudioActiveOutputNodeChanged();
1236 }
1237
1238 void SystemTrayDelegateChromeOS::OnActiveInputNodeChanged() {
1239 GetSystemTrayNotifier()->NotifyAudioActiveInputNodeChanged();
1240 }
1241
1209 // drive::JobListObserver overrides. 1242 // drive::JobListObserver overrides.
1210 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { 1243 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) {
1211 OnJobUpdated(job_info); 1244 OnJobUpdated(job_info);
1212 } 1245 }
1213 1246
1214 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, 1247 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info,
1215 drive::FileError error) { 1248 drive::FileError error) {
1216 ash::DriveOperationStatus status; 1249 ash::DriveOperationStatus status;
1217 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status)) 1250 if (ConvertToFinishedDriveOperationStatus(job_info, error, &status))
1218 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status); 1251 GetSystemTrayNotifier()->NotifyDriveJobUpdated(status);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 void SystemTrayDelegateChromeOS::UserAddedToSession( 1334 void SystemTrayDelegateChromeOS::UserAddedToSession(
1302 const std::string& user_id) { 1335 const std::string& user_id) {
1303 GetSystemTrayNotifier()->NotifyUserAddedToSession(); 1336 GetSystemTrayNotifier()->NotifyUserAddedToSession();
1304 } 1337 }
1305 1338
1306 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1339 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1307 return new SystemTrayDelegateChromeOS(); 1340 return new SystemTrayDelegateChromeOS();
1308 } 1341 }
1309 1342
1310 } // namespace chromeos 1343 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chromeos/audio/cras_audio_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698