| OLD | NEW |
| 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 <memory> | 10 #include <memory> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 39 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 40 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 40 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 41 #include "chrome/browser/ui/ash/system_tray_client.h" | 41 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 42 #include "chrome/browser/ui/browser.h" | 42 #include "chrome/browser/ui/browser.h" |
| 43 #include "chrome/browser/ui/browser_list.h" | 43 #include "chrome/browser/ui/browser_list.h" |
| 44 #include "chrome/browser/ui/chrome_pages.h" | 44 #include "chrome/browser/ui/chrome_pages.h" |
| 45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 46 #include "chrome/common/features.h" | 46 #include "chrome/common/features.h" |
| 47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
| 48 #include "chrome/grit/generated_resources.h" | 48 #include "chrome/grit/generated_resources.h" |
| 49 #include "chromeos/dbus/dbus_thread_manager.h" |
| 49 #include "chromeos/login/login_state.h" | 50 #include "chromeos/login/login_state.h" |
| 50 #include "chromeos/network/portal_detector/network_portal_detector.h" | 51 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 51 #include "components/google/core/browser/google_util.h" | 52 #include "components/google/core/browser/google_util.h" |
| 52 #include "components/prefs/pref_service.h" | 53 #include "components/prefs/pref_service.h" |
| 53 #include "components/session_manager/core/session_manager.h" | 54 #include "components/session_manager/core/session_manager.h" |
| 54 #include "components/user_manager/user.h" | 55 #include "components/user_manager/user.h" |
| 55 #include "components/user_manager/user_manager.h" | 56 #include "components/user_manager/user_manager.h" |
| 56 #include "components/user_manager/user_type.h" | 57 #include "components/user_manager/user_type.h" |
| 57 #include "content/public/browser/notification_observer.h" | 58 #include "content/public/browser/notification_observer.h" |
| 58 #include "content/public/browser/notification_service.h" | 59 #include "content/public/browser/notification_service.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, | 113 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, |
| 113 base::Unretained(this))); | 114 base::Unretained(this))); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void SystemTrayDelegateChromeOS::Initialize() { | 117 void SystemTrayDelegateChromeOS::Initialize() { |
| 117 input_method::InputMethodManager::Get()->AddObserver(this); | 118 input_method::InputMethodManager::Get()->AddObserver(this); |
| 118 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); | 119 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); |
| 119 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); | 120 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); |
| 120 | 121 |
| 121 BrowserList::AddObserver(this); | 122 BrowserList::AddObserver(this); |
| 123 |
| 124 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); |
| 122 } | 125 } |
| 123 | 126 |
| 124 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { | 127 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { |
| 125 user_pref_registrar_.reset(); | 128 user_pref_registrar_.reset(); |
| 126 | 129 |
| 127 // Unregister content notifications before destroying any components. | 130 // Unregister content notifications before destroying any components. |
| 128 registrar_.reset(); | 131 registrar_.reset(); |
| 129 | 132 |
| 130 // Unregister a11y status subscription. | 133 // Unregister a11y status subscription. |
| 131 accessibility_subscription_.reset(); | 134 accessibility_subscription_.reset(); |
| 132 | 135 |
| 133 input_method::InputMethodManager::Get()->RemoveObserver(this); | 136 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 134 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); | 137 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); |
| 135 | 138 |
| 136 BrowserList::RemoveObserver(this); | 139 BrowserList::RemoveObserver(this); |
| 137 StopObservingAppWindowRegistry(); | 140 StopObservingAppWindowRegistry(); |
| 141 |
| 142 if (DBusThreadManager::IsInitialized()) |
| 143 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); |
| 138 } | 144 } |
| 139 | 145 |
| 140 void SystemTrayDelegateChromeOS::ShowUserLogin() { | 146 void SystemTrayDelegateChromeOS::ShowUserLogin() { |
| 141 if (!ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) | 147 if (!ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) |
| 142 return; | 148 return; |
| 143 | 149 |
| 144 // Only regular non-supervised users could add other users to current session. | 150 // Only regular non-supervised users could add other users to current session. |
| 145 if (user_manager::UserManager::Get()->GetActiveUser()->GetType() != | 151 if (user_manager::UserManager::Get()->GetActiveUser()->GetType() != |
| 146 user_manager::USER_TYPE_REGULAR) { | 152 user_manager::USER_TYPE_REGULAR) { |
| 147 return; | 153 return; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { | 439 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { |
| 434 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); | 440 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); |
| 435 } | 441 } |
| 436 | 442 |
| 437 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} | 443 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} |
| 438 | 444 |
| 439 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( | 445 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( |
| 440 const std::string& engine_id, | 446 const std::string& engine_id, |
| 441 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} | 447 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} |
| 442 | 448 |
| 449 void SystemTrayDelegateChromeOS::OnUpdateOverCellularTargetSet(bool success) { |
| 450 GetSystemTrayNotifier()->NotifyUpdateOverCellularTargetSet(success); |
| 451 } |
| 452 |
| 443 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 453 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 444 return new SystemTrayDelegateChromeOS(); | 454 return new SystemTrayDelegateChromeOS(); |
| 445 } | 455 } |
| 446 | 456 |
| 447 } // namespace chromeos | 457 } // namespace chromeos |
| OLD | NEW |