| 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 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/accessibility_types.h" | 14 #include "ash/accessibility_types.h" |
| 15 #include "ash/system/supervised/custodian_info_tray_observer.h" | |
| 16 #include "ash/system/tray/ime_info.h" | 15 #include "ash/system/tray/ime_info.h" |
| 17 #include "ash/system/tray/system_tray_delegate.h" | 16 #include "ash/system/tray/system_tray_delegate.h" |
| 18 #include "base/macros.h" | 17 #include "base/macros.h" |
| 19 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 20 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | |
| 23 #include "chrome/browser/ui/browser_list_observer.h" | 21 #include "chrome/browser/ui/browser_list_observer.h" |
| 24 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 22 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 25 #include "components/prefs/pref_change_registrar.h" | 23 #include "components/prefs/pref_change_registrar.h" |
| 26 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 28 #include "extensions/browser/app_window/app_window_registry.h" | 26 #include "extensions/browser/app_window/app_window_registry.h" |
| 29 #include "ui/base/ime/chromeos/ime_keyboard.h" | 27 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 30 #include "ui/base/ime/chromeos/input_method_manager.h" | 28 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 31 #include "ui/chromeos/ime/input_method_menu_manager.h" | 29 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 32 | 30 |
| 33 namespace ash { | 31 namespace ash { |
| 34 class SystemTrayNotifier; | 32 class SystemTrayNotifier; |
| 35 } | 33 } |
| 36 | 34 |
| 37 namespace chromeos { | 35 namespace chromeos { |
| 38 | 36 |
| 39 class SystemTrayDelegateChromeOS | 37 class SystemTrayDelegateChromeOS |
| 40 : public ui::ime::InputMethodMenuManager::Observer, | 38 : public ui::ime::InputMethodMenuManager::Observer, |
| 41 public ash::SystemTrayDelegate, | 39 public ash::SystemTrayDelegate, |
| 42 public content::NotificationObserver, | 40 public content::NotificationObserver, |
| 43 public input_method::InputMethodManager::Observer, | 41 public input_method::InputMethodManager::Observer, |
| 44 public policy::CloudPolicyStore::Observer, | 42 public policy::CloudPolicyStore::Observer, |
| 45 public chrome::BrowserListObserver, | 43 public chrome::BrowserListObserver, |
| 46 public extensions::AppWindowRegistry::Observer, | 44 public extensions::AppWindowRegistry::Observer, |
| 47 public SupervisedUserServiceObserver, | |
| 48 public input_method::InputMethodManager::ImeMenuObserver { | 45 public input_method::InputMethodManager::ImeMenuObserver { |
| 49 public: | 46 public: |
| 50 SystemTrayDelegateChromeOS(); | 47 SystemTrayDelegateChromeOS(); |
| 51 ~SystemTrayDelegateChromeOS() override; | 48 ~SystemTrayDelegateChromeOS() override; |
| 52 | 49 |
| 53 // Overridden from ash::SystemTrayDelegate: | 50 // Overridden from ash::SystemTrayDelegate: |
| 54 void Initialize() override; | 51 void Initialize() override; |
| 55 ash::LoginStatus GetUserLoginStatus() const override; | 52 ash::LoginStatus GetUserLoginStatus() const override; |
| 56 std::string GetEnterpriseDomain() const override; | 53 std::string GetEnterpriseDomain() const override; |
| 57 base::string16 GetEnterpriseMessage() const override; | 54 base::string16 GetEnterpriseMessage() const override; |
| 58 std::string GetSupervisedUserManager() const override; | |
| 59 base::string16 GetSupervisedUserManagerName() const override; | |
| 60 base::string16 GetSupervisedUserMessage() const override; | |
| 61 void ShowEnterpriseInfo() override; | 55 void ShowEnterpriseInfo() override; |
| 62 void ShowUserLogin() override; | 56 void ShowUserLogin() override; |
| 63 void GetCurrentIME(ash::IMEInfo* info) override; | 57 void GetCurrentIME(ash::IMEInfo* info) override; |
| 64 void GetAvailableIMEList(ash::IMEInfoList* list) override; | 58 void GetAvailableIMEList(ash::IMEInfoList* list) override; |
| 65 void GetCurrentIMEProperties(ash::IMEPropertyInfoList* list) override; | 59 void GetCurrentIMEProperties(ash::IMEPropertyInfoList* list) override; |
| 66 base::string16 GetIMEManagedMessage() override; | 60 base::string16 GetIMEManagedMessage() override; |
| 67 void SwitchIME(const std::string& ime_id) override; | 61 void SwitchIME(const std::string& ime_id) override; |
| 68 void ActivateIMEProperty(const std::string& key) override; | 62 void ActivateIMEProperty(const std::string& key) override; |
| 69 ash::NetworkingConfigDelegate* GetNetworkingConfigDelegate() const override; | 63 ash::NetworkingConfigDelegate* GetNetworkingConfigDelegate() const override; |
| 70 bool GetSessionStartTime(base::TimeTicks* session_start_time) override; | 64 bool GetSessionStartTime(base::TimeTicks* session_start_time) override; |
| 71 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override; | 65 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override; |
| 72 void ActiveUserWasChanged() override; | 66 void ActiveUserWasChanged() override; |
| 73 bool IsSearchKeyMappedToCapsLock() override; | 67 bool IsSearchKeyMappedToCapsLock() override; |
| 74 void AddCustodianInfoTrayObserver( | |
| 75 ash::CustodianInfoTrayObserver* observer) override; | |
| 76 void RemoveCustodianInfoTrayObserver( | |
| 77 ash::CustodianInfoTrayObserver* observer) override; | |
| 78 std::unique_ptr<ash::SystemTrayItem> CreateRotationLockTrayItem( | 68 std::unique_ptr<ash::SystemTrayItem> CreateRotationLockTrayItem( |
| 79 ash::SystemTray* tray) override; | 69 ash::SystemTray* tray) override; |
| 80 | 70 |
| 81 private: | 71 private: |
| 82 ash::SystemTrayNotifier* GetSystemTrayNotifier(); | 72 ash::SystemTrayNotifier* GetSystemTrayNotifier(); |
| 83 | 73 |
| 84 void SetProfile(Profile* profile); | 74 void SetProfile(Profile* profile); |
| 85 | 75 |
| 86 bool UnsetProfile(Profile* profile); | 76 bool UnsetProfile(Profile* profile); |
| 87 | 77 |
| 88 void UpdateShowLogoutButtonInTray(); | 78 void UpdateShowLogoutButtonInTray(); |
| 89 | 79 |
| 90 void UpdateLogoutDialogDuration(); | 80 void UpdateLogoutDialogDuration(); |
| 91 | 81 |
| 92 void UpdateSessionStartTime(); | 82 void UpdateSessionStartTime(); |
| 93 | 83 |
| 94 void UpdateSessionLengthLimit(); | 84 void UpdateSessionLengthLimit(); |
| 95 | 85 |
| 96 void StopObservingAppWindowRegistry(); | 86 void StopObservingAppWindowRegistry(); |
| 97 | 87 |
| 98 void StopObservingCustodianInfoChanges(); | |
| 99 | |
| 100 // Notify observers if the current user has no more open browser or app | 88 // Notify observers if the current user has no more open browser or app |
| 101 // windows. | 89 // windows. |
| 102 void NotifyIfLastWindowClosed(); | 90 void NotifyIfLastWindowClosed(); |
| 103 | 91 |
| 104 // content::NotificationObserver implementation. | 92 // content::NotificationObserver implementation. |
| 105 void Observe(int type, | 93 void Observe(int type, |
| 106 const content::NotificationSource& source, | 94 const content::NotificationSource& source, |
| 107 const content::NotificationDetails& details) override; | 95 const content::NotificationDetails& details) override; |
| 108 | 96 |
| 109 void OnLanguageRemapSearchKeyToChanged(); | 97 void OnLanguageRemapSearchKeyToChanged(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 // Overridden from CloudPolicyStore::Observer | 115 // Overridden from CloudPolicyStore::Observer |
| 128 void OnStoreLoaded(policy::CloudPolicyStore* store) override; | 116 void OnStoreLoaded(policy::CloudPolicyStore* store) override; |
| 129 void OnStoreError(policy::CloudPolicyStore* store) override; | 117 void OnStoreError(policy::CloudPolicyStore* store) override; |
| 130 | 118 |
| 131 // Overridden from chrome::BrowserListObserver: | 119 // Overridden from chrome::BrowserListObserver: |
| 132 void OnBrowserRemoved(Browser* browser) override; | 120 void OnBrowserRemoved(Browser* browser) override; |
| 133 | 121 |
| 134 // Overridden from extensions::AppWindowRegistry::Observer: | 122 // Overridden from extensions::AppWindowRegistry::Observer: |
| 135 void OnAppWindowRemoved(extensions::AppWindow* app_window) override; | 123 void OnAppWindowRemoved(extensions::AppWindow* app_window) override; |
| 136 | 124 |
| 137 // Overridden from SupervisedUserServiceObserver: | |
| 138 void OnCustodianInfoChanged() override; | |
| 139 | |
| 140 void OnAccessibilityStatusChanged( | 125 void OnAccessibilityStatusChanged( |
| 141 const AccessibilityStatusEventDetails& details); | 126 const AccessibilityStatusEventDetails& details); |
| 142 | 127 |
| 143 // input_method::InputMethodManager::ImeMenuObserver: | 128 // input_method::InputMethodManager::ImeMenuObserver: |
| 144 void ImeMenuActivationChanged(bool is_active) override; | 129 void ImeMenuActivationChanged(bool is_active) override; |
| 145 void ImeMenuListChanged() override; | 130 void ImeMenuListChanged() override; |
| 146 void ImeMenuItemsChanged( | 131 void ImeMenuItemsChanged( |
| 147 const std::string& engine_id, | 132 const std::string& engine_id, |
| 148 const std::vector<input_method::InputMethodManager::MenuItem>& items) | 133 const std::vector<input_method::InputMethodManager::MenuItem>& items) |
| 149 override; | 134 override; |
| 150 | 135 |
| 151 // helper methods used by GetSupervisedUserMessage. | |
| 152 const base::string16 GetLegacySupervisedUserMessage() const; | |
| 153 const base::string16 GetChildUserMessage() const; | |
| 154 | |
| 155 std::unique_ptr<content::NotificationRegistrar> registrar_; | 136 std::unique_ptr<content::NotificationRegistrar> registrar_; |
| 156 std::unique_ptr<PrefChangeRegistrar> local_state_registrar_; | 137 std::unique_ptr<PrefChangeRegistrar> local_state_registrar_; |
| 157 std::unique_ptr<PrefChangeRegistrar> user_pref_registrar_; | 138 std::unique_ptr<PrefChangeRegistrar> user_pref_registrar_; |
| 158 Profile* user_profile_ = nullptr; | 139 Profile* user_profile_ = nullptr; |
| 159 int search_key_mapped_to_ = input_method::kSearchKey; | 140 int search_key_mapped_to_ = input_method::kSearchKey; |
| 160 bool have_session_start_time_ = false; | 141 bool have_session_start_time_ = false; |
| 161 base::TimeTicks session_start_time_; | 142 base::TimeTicks session_start_time_; |
| 162 bool have_session_length_limit_ = false; | 143 bool have_session_length_limit_ = false; |
| 163 base::TimeDelta session_length_limit_; | 144 base::TimeDelta session_length_limit_; |
| 164 std::string enterprise_domain_; | 145 std::string enterprise_domain_; |
| 165 bool is_active_directory_managed_ = false; | 146 bool is_active_directory_managed_ = false; |
| 166 bool session_started_ = false; | 147 bool session_started_ = false; |
| 167 | 148 |
| 168 std::unique_ptr<ash::NetworkingConfigDelegate> networking_config_delegate_; | 149 std::unique_ptr<ash::NetworkingConfigDelegate> networking_config_delegate_; |
| 169 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 150 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 170 | 151 |
| 171 base::ObserverList<ash::CustodianInfoTrayObserver> | |
| 172 custodian_info_changed_observers_; | |
| 173 | |
| 174 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); | 152 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); |
| 175 }; | 153 }; |
| 176 | 154 |
| 177 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); | 155 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); |
| 178 | 156 |
| 179 } // namespace chromeos | 157 } // namespace chromeos |
| 180 | 158 |
| 181 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 159 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |