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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 virtual void ShowBluetoothSettings() OVERRIDE { | 497 virtual void ShowBluetoothSettings() OVERRIDE { |
497 // TODO(sad): Make this work. | 498 // TODO(sad): Make this work. |
498 } | 499 } |
499 | 500 |
500 virtual void ShowDisplaySettings() OVERRIDE { | 501 virtual void ShowDisplaySettings() OVERRIDE { |
501 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); | 502 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); |
502 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 503 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
503 kDisplaySettingsSubPageName); | 504 kDisplaySettingsSubPageName); |
504 } | 505 } |
505 | 506 |
| 507 virtual void ShowChromeSlow() OVERRIDE { |
| 508 chrome::ShowSlow(GetAppropriateBrowser()); |
| 509 } |
| 510 |
506 virtual bool ShouldShowDisplayNotification() OVERRIDE { | 511 virtual bool ShouldShowDisplayNotification() OVERRIDE { |
507 // Packaged app is not counted as 'last active', so if a browser opening the | 512 // Packaged app is not counted as 'last active', so if a browser opening the |
508 // display settings is in background of a packaged app, it will return true. | 513 // display settings is in background of a packaged app, it will return true. |
509 // TODO(mukai): fix this. | 514 // TODO(mukai): fix this. |
510 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( | 515 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( |
511 chrome::HOST_DESKTOP_TYPE_ASH); | 516 chrome::HOST_DESKTOP_TYPE_ASH); |
512 if (!active_browser) | 517 if (!active_browser) |
513 return true; | 518 return true; |
514 | 519 |
515 content::WebContents* active_contents = | 520 content::WebContents* active_contents = |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 user_pref_registrar_->Add( | 926 user_pref_registrar_->Add( |
922 prefs::kLargeCursorEnabled, | 927 prefs::kLargeCursorEnabled, |
923 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 928 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
924 base::Unretained(this), | 929 base::Unretained(this), |
925 ash::A11Y_NOTIFICATION_NONE)); | 930 ash::A11Y_NOTIFICATION_NONE)); |
926 user_pref_registrar_->Add( | 931 user_pref_registrar_->Add( |
927 prefs::kShouldAlwaysShowAccessibilityMenu, | 932 prefs::kShouldAlwaysShowAccessibilityMenu, |
928 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 933 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
929 base::Unretained(this), | 934 base::Unretained(this), |
930 ash::A11Y_NOTIFICATION_NONE)); | 935 ash::A11Y_NOTIFICATION_NONE)); |
| 936 user_pref_registrar_->Add( |
| 937 prefs::kPerformanceTracingEnabled, |
| 938 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
| 939 base::Unretained(this))); |
931 | 940 |
932 UpdateClockType(); | 941 UpdateClockType(); |
933 UpdateShowLogoutButtonInTray(); | 942 UpdateShowLogoutButtonInTray(); |
| 943 UpdatePerformanceTracing(); |
934 search_key_mapped_to_ = | 944 search_key_mapped_to_ = |
935 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 945 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
936 } | 946 } |
937 | 947 |
938 bool UnsetProfile(Profile* profile) { | 948 bool UnsetProfile(Profile* profile) { |
939 if (profile != user_profile_) | 949 if (profile != user_profile_) |
940 return false; | 950 return false; |
941 user_pref_registrar_.reset(); | 951 user_pref_registrar_.reset(); |
942 return true; | 952 return true; |
943 } | 953 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 void OnLanguageRemapSearchKeyToChanged() { | 1150 void OnLanguageRemapSearchKeyToChanged() { |
1141 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( | 1151 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( |
1142 prefs::kLanguageRemapSearchKeyTo); | 1152 prefs::kLanguageRemapSearchKeyTo); |
1143 } | 1153 } |
1144 | 1154 |
1145 void OnAccessibilityModeChanged( | 1155 void OnAccessibilityModeChanged( |
1146 ash::AccessibilityNotificationVisibility notify) { | 1156 ash::AccessibilityNotificationVisibility notify) { |
1147 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); | 1157 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); |
1148 } | 1158 } |
1149 | 1159 |
| 1160 void UpdatePerformanceTracing() { |
| 1161 if (!user_pref_registrar_) |
| 1162 return; |
| 1163 bool value = |
| 1164 user_pref_registrar_->prefs()->GetBoolean( |
| 1165 prefs::kPerformanceTracingEnabled); |
| 1166 GetSystemTrayNotifier()->NotifyTracingModeChanged(value); |
| 1167 } |
| 1168 |
1150 // Overridden from InputMethodManager::Observer. | 1169 // Overridden from InputMethodManager::Observer. |
1151 virtual void InputMethodChanged( | 1170 virtual void InputMethodChanged( |
1152 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1171 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
1153 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1172 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1154 } | 1173 } |
1155 | 1174 |
1156 virtual void InputMethodPropertyChanged( | 1175 virtual void InputMethodPropertyChanged( |
1157 input_method::InputMethodManager* manager) OVERRIDE { | 1176 input_method::InputMethodManager* manager) OVERRIDE { |
1158 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1177 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
1159 } | 1178 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1374 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1356 }; | 1375 }; |
1357 | 1376 |
1358 } // namespace | 1377 } // namespace |
1359 | 1378 |
1360 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1379 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1361 return new chromeos::SystemTrayDelegate(); | 1380 return new chromeos::SystemTrayDelegate(); |
1362 } | 1381 } |
1363 | 1382 |
1364 } // namespace chromeos | 1383 } // namespace chromeos |
OLD | NEW |