| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 virtual void ShowBluetoothSettings() OVERRIDE { | 514 virtual void ShowBluetoothSettings() OVERRIDE { |
| 514 // TODO(sad): Make this work. | 515 // TODO(sad): Make this work. |
| 515 } | 516 } |
| 516 | 517 |
| 517 virtual void ShowDisplaySettings() OVERRIDE { | 518 virtual void ShowDisplaySettings() OVERRIDE { |
| 518 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); | 519 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); |
| 519 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 520 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
| 520 kDisplaySettingsSubPageName); | 521 kDisplaySettingsSubPageName); |
| 521 } | 522 } |
| 522 | 523 |
| 524 virtual void ShowSlow() OVERRIDE { |
| 525 chrome::ShowSlow(GetAppropriateBrowser()); |
| 526 } |
| 527 |
| 523 virtual bool ShouldShowDisplayNotification() OVERRIDE { | 528 virtual bool ShouldShowDisplayNotification() OVERRIDE { |
| 524 // Packaged app is not counted as 'last active', so if a browser opening the | 529 // Packaged app is not counted as 'last active', so if a browser opening the |
| 525 // display settings is in background of a packaged app, it will return true. | 530 // display settings is in background of a packaged app, it will return true. |
| 526 // TODO(mukai): fix this. | 531 // TODO(mukai): fix this. |
| 527 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( | 532 Browser* active_browser = chrome::FindLastActiveWithHostDesktopType( |
| 528 chrome::HOST_DESKTOP_TYPE_ASH); | 533 chrome::HOST_DESKTOP_TYPE_ASH); |
| 529 if (!active_browser) | 534 if (!active_browser) |
| 530 return true; | 535 return true; |
| 531 | 536 |
| 532 content::WebContents* active_contents = | 537 content::WebContents* active_contents = |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 user_pref_registrar_->Add( | 942 user_pref_registrar_->Add( |
| 938 prefs::kLargeCursorEnabled, | 943 prefs::kLargeCursorEnabled, |
| 939 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 944 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 940 base::Unretained(this), | 945 base::Unretained(this), |
| 941 ash::A11Y_NOTIFICATION_NONE)); | 946 ash::A11Y_NOTIFICATION_NONE)); |
| 942 user_pref_registrar_->Add( | 947 user_pref_registrar_->Add( |
| 943 prefs::kShouldAlwaysShowAccessibilityMenu, | 948 prefs::kShouldAlwaysShowAccessibilityMenu, |
| 944 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 949 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 945 base::Unretained(this), | 950 base::Unretained(this), |
| 946 ash::A11Y_NOTIFICATION_NONE)); | 951 ash::A11Y_NOTIFICATION_NONE)); |
| 952 user_pref_registrar_->Add( |
| 953 prefs::kPerformanceTracingEnabled, |
| 954 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
| 955 base::Unretained(this))); |
| 947 | 956 |
| 948 UpdateClockType(); | 957 UpdateClockType(); |
| 949 UpdateShowLogoutButtonInTray(); | 958 UpdateShowLogoutButtonInTray(); |
| 959 UpdatePerformanceTracing(); |
| 950 search_key_mapped_to_ = | 960 search_key_mapped_to_ = |
| 951 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 961 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
| 952 } | 962 } |
| 953 | 963 |
| 954 bool UnsetProfile(Profile* profile) { | 964 bool UnsetProfile(Profile* profile) { |
| 955 if (profile != user_profile_) | 965 if (profile != user_profile_) |
| 956 return false; | 966 return false; |
| 957 user_pref_registrar_.reset(); | 967 user_pref_registrar_.reset(); |
| 958 return true; | 968 return true; |
| 959 } | 969 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 void OnLanguageRemapSearchKeyToChanged() { | 1166 void OnLanguageRemapSearchKeyToChanged() { |
| 1157 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( | 1167 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( |
| 1158 prefs::kLanguageRemapSearchKeyTo); | 1168 prefs::kLanguageRemapSearchKeyTo); |
| 1159 } | 1169 } |
| 1160 | 1170 |
| 1161 void OnAccessibilityModeChanged( | 1171 void OnAccessibilityModeChanged( |
| 1162 ash::AccessibilityNotificationVisibility notify) { | 1172 ash::AccessibilityNotificationVisibility notify) { |
| 1163 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); | 1173 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(notify); |
| 1164 } | 1174 } |
| 1165 | 1175 |
| 1176 void UpdatePerformanceTracing() { |
| 1177 if (!user_pref_registrar_) |
| 1178 return; |
| 1179 bool value = |
| 1180 user_pref_registrar_->prefs()->GetBoolean( |
| 1181 prefs::kPerformanceTracingEnabled); |
| 1182 GetSystemTrayNotifier()->NotifyTracingModeChanged(value); |
| 1183 } |
| 1184 |
| 1166 // Overridden from InputMethodManager::Observer. | 1185 // Overridden from InputMethodManager::Observer. |
| 1167 virtual void InputMethodChanged( | 1186 virtual void InputMethodChanged( |
| 1168 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1187 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
| 1169 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1188 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
| 1170 } | 1189 } |
| 1171 | 1190 |
| 1172 virtual void InputMethodPropertyChanged( | 1191 virtual void InputMethodPropertyChanged( |
| 1173 input_method::InputMethodManager* manager) OVERRIDE { | 1192 input_method::InputMethodManager* manager) OVERRIDE { |
| 1174 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1193 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
| 1175 } | 1194 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1388 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1370 }; | 1389 }; |
| 1371 | 1390 |
| 1372 } // namespace | 1391 } // namespace |
| 1373 | 1392 |
| 1374 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1393 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1375 return new chromeos::SystemTrayDelegate(); | 1394 return new chromeos::SystemTrayDelegate(); |
| 1376 } | 1395 } |
| 1377 | 1396 |
| 1378 } // namespace chromeos | 1397 } // namespace chromeos |
| OLD | NEW |