| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "chrome/browser/chromeos/mobile_config.h" | 65 #include "chrome/browser/chromeos/mobile_config.h" |
| 66 #include "chrome/browser/chromeos/options/network_config_view.h" | 66 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 67 #include "chrome/browser/chromeos/options/network_connect.h" | 67 #include "chrome/browser/chromeos/options/network_connect.h" |
| 68 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 68 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 69 #include "chrome/browser/chromeos/settings/cros_settings.h" | 69 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 70 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 70 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 71 #include "chrome/browser/chromeos/status/data_promo_notification.h" | 71 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
| 72 #include "chrome/browser/chromeos/system/timezone_settings.h" | 72 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 73 #include "chrome/browser/chromeos/system_key_event_listener.h" | 73 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 74 #include "chrome/browser/drive/drive_service_interface.h" | 74 #include "chrome/browser/drive/drive_service_interface.h" |
| 75 #include "chrome/browser/feedback/tracing_manager.h" |
| 75 #include "chrome/browser/google/google_util.h" | 76 #include "chrome/browser/google/google_util.h" |
| 76 #include "chrome/browser/lifetime/application_lifetime.h" | 77 #include "chrome/browser/lifetime/application_lifetime.h" |
| 77 #include "chrome/browser/policy/browser_policy_connector.h" | 78 #include "chrome/browser/policy/browser_policy_connector.h" |
| 78 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 79 #include "chrome/browser/policy/cloud/cloud_policy_store.h" |
| 79 #include "chrome/browser/profiles/profile_manager.h" | 80 #include "chrome/browser/profiles/profile_manager.h" |
| 80 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 81 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
| 81 #include "chrome/browser/ui/browser.h" | 82 #include "chrome/browser/ui/browser.h" |
| 82 #include "chrome/browser/ui/browser_finder.h" | 83 #include "chrome/browser/ui/browser_finder.h" |
| 83 #include "chrome/browser/ui/chrome_pages.h" | 84 #include "chrome/browser/ui/chrome_pages.h" |
| 84 #include "chrome/browser/ui/host_desktop.h" | 85 #include "chrome/browser/ui/host_desktop.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 virtual void ShowBluetoothSettings() OVERRIDE { | 513 virtual void ShowBluetoothSettings() OVERRIDE { |
| 513 // TODO(sad): Make this work. | 514 // TODO(sad): Make this work. |
| 514 } | 515 } |
| 515 | 516 |
| 516 virtual void ShowDisplaySettings() OVERRIDE { | 517 virtual void ShowDisplaySettings() OVERRIDE { |
| 517 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); | 518 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); |
| 518 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 519 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
| 519 kDisplaySettingsSubPageName); | 520 kDisplaySettingsSubPageName); |
| 520 } | 521 } |
| 521 | 522 |
| 523 virtual void ShowSlow() OVERRIDE { |
| 524 chrome::ShowSlow(GetAppropriateBrowser()); |
| 525 } |
| 526 |
| 522 virtual bool ShouldShowDisplayNotification() OVERRIDE { | 527 virtual bool ShouldShowDisplayNotification() OVERRIDE { |
| 523 // Packaged app is not counted as 'last active', so if a browser opening the | 528 // Packaged app is not counted as 'last active', so if a browser opening the |
| 524 // display settings is in background of a packaged app, it will return true. | 529 // display settings is in background of a packaged app, it will return true. |
| 525 // TODO(mukai): fix this. | 530 // TODO(mukai): fix this. |
| 526 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( | 531 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( |
| 527 chrome::HOST_DESKTOP_TYPE_ASH); | 532 chrome::HOST_DESKTOP_TYPE_ASH); |
| 528 if (!active_browser) | 533 if (!active_browser) |
| 529 return true; | 534 return true; |
| 530 | 535 |
| 531 content::WebContents* active_contents = | 536 content::WebContents* active_contents = |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 user_pref_registrar_->Add( | 941 user_pref_registrar_->Add( |
| 937 prefs::kLargeCursorEnabled, | 942 prefs::kLargeCursorEnabled, |
| 938 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 943 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 939 base::Unretained(this), | 944 base::Unretained(this), |
| 940 ash::A11Y_NOTIFICATION_NONE)); | 945 ash::A11Y_NOTIFICATION_NONE)); |
| 941 user_pref_registrar_->Add( | 946 user_pref_registrar_->Add( |
| 942 prefs::kShouldAlwaysShowAccessibilityMenu, | 947 prefs::kShouldAlwaysShowAccessibilityMenu, |
| 943 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 948 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 944 base::Unretained(this), | 949 base::Unretained(this), |
| 945 ash::A11Y_NOTIFICATION_NONE)); | 950 ash::A11Y_NOTIFICATION_NONE)); |
| 951 user_pref_registrar_->Add( |
| 952 prefs::kPerformanceTracingEnabled, |
| 953 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
| 954 base::Unretained(this))); |
| 946 | 955 |
| 947 UpdateClockType(); | 956 UpdateClockType(); |
| 948 UpdateShowLogoutButtonInTray(); | 957 UpdateShowLogoutButtonInTray(); |
| 958 UpdatePerformanceTracing(); |
| 949 search_key_mapped_to_ = | 959 search_key_mapped_to_ = |
| 950 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 960 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
| 951 } | 961 } |
| 952 | 962 |
| 953 bool UnsetProfile(Profile* profile) { | 963 bool UnsetProfile(Profile* profile) { |
| 954 if (profile != user_profile_) | 964 if (profile != user_profile_) |
| 955 return false; | 965 return false; |
| 956 user_pref_registrar_.reset(); | 966 user_pref_registrar_.reset(); |
| 957 return true; | 967 return true; |
| 958 } | 968 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 void OnLanguageRemapSearchKeyToChanged() { | 1165 void OnLanguageRemapSearchKeyToChanged() { |
| 1156 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( | 1166 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( |
| 1157 prefs::kLanguageRemapSearchKeyTo); | 1167 prefs::kLanguageRemapSearchKeyTo); |
| 1158 } | 1168 } |
| 1159 | 1169 |
| 1160 void OnAccessibilityModeChanged( | 1170 void OnAccessibilityModeChanged( |
| 1161 ash::AccessibilityNotificationVisibility notify) { | 1171 ash::AccessibilityNotificationVisibility notify) { |
| 1162 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); | 1172 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); |
| 1163 } | 1173 } |
| 1164 | 1174 |
| 1175 void UpdatePerformanceTracing() { |
| 1176 if (!user_pref_registrar_) |
| 1177 return; |
| 1178 bool value = |
| 1179 user_pref_registrar_->prefs()->GetBoolean( |
| 1180 prefs::kPerformanceTracingEnabled); |
| 1181 GetSystemTrayNotifier()->NotifyTracingModeChanged(value); |
| 1182 } |
| 1183 |
| 1165 // Overridden from InputMethodManager::Observer. | 1184 // Overridden from InputMethodManager::Observer. |
| 1166 virtual void InputMethodChanged( | 1185 virtual void InputMethodChanged( |
| 1167 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1186 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
| 1168 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1187 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
| 1169 } | 1188 } |
| 1170 | 1189 |
| 1171 virtual void InputMethodPropertyChanged( | 1190 virtual void InputMethodPropertyChanged( |
| 1172 input_method::InputMethodManager* manager) OVERRIDE { | 1191 input_method::InputMethodManager* manager) OVERRIDE { |
| 1173 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1192 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
| 1174 } | 1193 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1387 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1369 }; | 1388 }; |
| 1370 | 1389 |
| 1371 } // namespace | 1390 } // namespace |
| 1372 | 1391 |
| 1373 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1392 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1374 return new chromeos::SystemTrayDelegate(); | 1393 return new chromeos::SystemTrayDelegate(); |
| 1375 } | 1394 } |
| 1376 | 1395 |
| 1377 } // namespace chromeos | 1396 } // namespace chromeos |
| OLD | NEW |