Chromium Code Reviews| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/system/audio/audio_observer.h" | 9 #include "ash/system/audio/audio_observer.h" |
| 10 #include "ash/system/bluetooth/bluetooth_observer.h" | 10 #include "ash/system/bluetooth/bluetooth_observer.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "base/memory/weak_ptr.h" | 29 #include "base/memory/weak_ptr.h" |
| 30 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
| 31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 33 #include "chrome/browser/chromeos/audio/audio_handler.h" | 33 #include "chrome/browser/chromeos/audio/audio_handler.h" |
| 34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| 35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
| 36 #include "chrome/browser/chromeos/cros/cros_library.h" | 36 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 37 #include "chrome/browser/chromeos/cros/network_library.h" | 37 #include "chrome/browser/chromeos/cros/network_library.h" |
| 38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 39 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | |
| 40 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 39 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 41 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 40 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 41 #include "chrome/browser/chromeos/gdata/operation_registry.h" | |
| 42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 43 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 43 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 46 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 46 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
| 47 #include "chrome/browser/chromeos/login/login_display_host.h" | 47 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 48 #include "chrome/browser/chromeos/login/message_bubble.h" | 48 #include "chrome/browser/chromeos/login/message_bubble.h" |
| 49 #include "chrome/browser/chromeos/login/user.h" | 49 #include "chrome/browser/chromeos/login/user.h" |
| 50 #include "chrome/browser/chromeos/login/user_manager.h" | 50 #include "chrome/browser/chromeos/login/user_manager.h" |
| 51 #include "chrome/browser/chromeos/mobile_config.h" | 51 #include "chrome/browser/chromeos/mobile_config.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 69 #include "chromeos/dbus/dbus_thread_manager.h" | 69 #include "chromeos/dbus/dbus_thread_manager.h" |
| 70 #include "chromeos/dbus/power_manager_client.h" | 70 #include "chromeos/dbus/power_manager_client.h" |
| 71 #include "chromeos/dbus/session_manager_client.h" | 71 #include "chromeos/dbus/session_manager_client.h" |
| 72 #include "content/public/browser/browser_thread.h" | 72 #include "content/public/browser/browser_thread.h" |
| 73 #include "content/public/browser/notification_observer.h" | 73 #include "content/public/browser/notification_observer.h" |
| 74 #include "content/public/browser/notification_service.h" | 74 #include "content/public/browser/notification_service.h" |
| 75 #include "content/public/browser/user_metrics.h" | 75 #include "content/public/browser/user_metrics.h" |
| 76 #include "grit/generated_resources.h" | 76 #include "grit/generated_resources.h" |
| 77 #include "ui/base/l10n/l10n_util.h" | 77 #include "ui/base/l10n/l10n_util.h" |
| 78 | 78 |
| 79 using gdata::GDataOperationRegistry; | 79 using gdata::OperationRegistry; |
|
kochi
2012/08/21 05:09:23
Sorted alphabetically.
| |
| 80 using gdata::GDataSystemService; | 80 using gdata::GDataSystemService; |
| 81 using gdata::GDataSystemServiceFactory; | 81 using gdata::GDataSystemServiceFactory; |
| 82 | 82 |
| 83 namespace chromeos { | 83 namespace chromeos { |
| 84 | 84 |
| 85 namespace { | 85 namespace { |
| 86 | 86 |
| 87 // Time delay for rechecking gdata operation when we suspect that there will | 87 // Time delay for rechecking gdata operation when we suspect that there will |
| 88 // be no upcoming activity notifications that need to be pushed to UI. | 88 // be no upcoming activity notifications that need to be pushed to UI. |
| 89 const int kGDataOperationRecheckDelayMs = 5000; | 89 const int kGDataOperationRecheckDelayMs = 5000; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 101 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, | 101 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, |
| 102 const input_method::InputMethodUtil& util, | 102 const input_method::InputMethodUtil& util, |
| 103 ash::IMEInfo* info) { | 103 ash::IMEInfo* info) { |
| 104 info->id = ime.id(); | 104 info->id = ime.id(); |
| 105 info->name = util.GetInputMethodLongName(ime); | 105 info->name = util.GetInputMethodLongName(ime); |
| 106 info->short_name = util.GetInputMethodShortName(ime); | 106 info->short_name = util.GetInputMethodShortName(ime); |
| 107 info->third_party = ime.third_party(); | 107 info->third_party = ime.third_party(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 ash::DriveOperationStatusList GetDriveStatusList( | 110 ash::DriveOperationStatusList GetDriveStatusList( |
| 111 const std::vector<GDataOperationRegistry::ProgressStatus>& list) { | 111 const std::vector<OperationRegistry::ProgressStatus>& list) { |
| 112 ash::DriveOperationStatusList results; | 112 ash::DriveOperationStatusList results; |
| 113 for (GDataOperationRegistry::ProgressStatusList::const_iterator it = | 113 for (OperationRegistry::ProgressStatusList::const_iterator it = |
| 114 list.begin(); | 114 list.begin(); |
| 115 it != list.end(); ++it) { | 115 it != list.end(); ++it) { |
| 116 ash::DriveOperationStatus status; | 116 ash::DriveOperationStatus status; |
| 117 status.file_path = it->file_path; | 117 status.file_path = it->file_path; |
| 118 status.progress = it->progress_total == 0 ? 0.0 : | 118 status.progress = it->progress_total == 0 ? 0.0 : |
| 119 static_cast<double>(it->progress_current) / | 119 static_cast<double>(it->progress_current) / |
| 120 static_cast<double>(it->progress_total); | 120 static_cast<double>(it->progress_total); |
| 121 status.type = static_cast<ash::DriveOperationStatus::OperationType>( | 121 status.type = static_cast<ash::DriveOperationStatus::OperationType>( |
| 122 it->operation_type); | 122 it->operation_type); |
| 123 status.state = static_cast<ash::DriveOperationStatus::OperationState>( | 123 status.state = static_cast<ash::DriveOperationStatus::OperationState>( |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 145 | 145 |
| 146 class SystemTrayDelegate : public ash::SystemTrayDelegate, | 146 class SystemTrayDelegate : public ash::SystemTrayDelegate, |
| 147 public AudioHandler::VolumeObserver, | 147 public AudioHandler::VolumeObserver, |
| 148 public PowerManagerClient::Observer, | 148 public PowerManagerClient::Observer, |
| 149 public SessionManagerClient::Observer, | 149 public SessionManagerClient::Observer, |
| 150 public NetworkMenuIcon::Delegate, | 150 public NetworkMenuIcon::Delegate, |
| 151 public NetworkMenu::Delegate, | 151 public NetworkMenu::Delegate, |
| 152 public NetworkLibrary::NetworkManagerObserver, | 152 public NetworkLibrary::NetworkManagerObserver, |
| 153 public NetworkLibrary::NetworkObserver, | 153 public NetworkLibrary::NetworkObserver, |
| 154 public NetworkLibrary::CellularDataPlanObserver, | 154 public NetworkLibrary::CellularDataPlanObserver, |
| 155 public gdata::GDataOperationRegistry::Observer, | 155 public gdata::OperationRegistry::Observer, |
| 156 public content::NotificationObserver, | 156 public content::NotificationObserver, |
| 157 public input_method::InputMethodManager::Observer, | 157 public input_method::InputMethodManager::Observer, |
| 158 public system::TimezoneSettings::Observer, | 158 public system::TimezoneSettings::Observer, |
| 159 public BluetoothAdapter::Observer, | 159 public BluetoothAdapter::Observer, |
| 160 public SystemKeyEventListener::CapsLockObserver, | 160 public SystemKeyEventListener::CapsLockObserver, |
| 161 public MessageBubbleLinkListener { | 161 public MessageBubbleLinkListener { |
| 162 public: | 162 public: |
| 163 explicit SystemTrayDelegate(ash::SystemTray* tray) | 163 explicit SystemTrayDelegate(ash::SystemTray* tray) |
| 164 : tray_(tray), | 164 : tray_(tray), |
| 165 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 165 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 virtual void InputMethodChanged( | 1081 virtual void InputMethodChanged( |
| 1082 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1082 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
| 1083 NotifyRefreshIME(show_message); | 1083 NotifyRefreshIME(show_message); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 virtual void InputMethodPropertyChanged( | 1086 virtual void InputMethodPropertyChanged( |
| 1087 input_method::InputMethodManager* manager) OVERRIDE { | 1087 input_method::InputMethodManager* manager) OVERRIDE { |
| 1088 NotifyRefreshIME(false); | 1088 NotifyRefreshIME(false); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 // gdata::GDataOperationRegistry::Observer overrides. | 1091 // gdata::OperationRegistry::Observer overrides. |
| 1092 virtual void OnProgressUpdate( | 1092 virtual void OnProgressUpdate( |
| 1093 const GDataOperationRegistry::ProgressStatusList& list) { | 1093 const OperationRegistry::ProgressStatusList& list) { |
| 1094 std::vector<ash::DriveOperationStatus> ui_list = GetDriveStatusList(list); | 1094 std::vector<ash::DriveOperationStatus> ui_list = GetDriveStatusList(list); |
| 1095 NotifyRefreshDrive(ui_list); | 1095 NotifyRefreshDrive(ui_list); |
| 1096 | 1096 |
| 1097 // If we have something to report right now (i.e. completion status only), | 1097 // If we have something to report right now (i.e. completion status only), |
| 1098 // we need to delayed re-check the status in few seconds to ensure we | 1098 // we need to delayed re-check the status in few seconds to ensure we |
| 1099 // raise events that will let us properly clear the uber tray state. | 1099 // raise events that will let us properly clear the uber tray state. |
| 1100 if (list.size() > 0) { | 1100 if (list.size() > 0) { |
| 1101 bool has_in_progress_items = false; | 1101 bool has_in_progress_items = false; |
| 1102 for (GDataOperationRegistry::ProgressStatusList::const_iterator it = | 1102 for (OperationRegistry::ProgressStatusList::const_iterator it = |
| 1103 list.begin(); | 1103 list.begin(); |
| 1104 it != list.end(); ++it) { | 1104 it != list.end(); ++it) { |
| 1105 if (it->transfer_state == | 1105 if (it->transfer_state == |
| 1106 GDataOperationRegistry::OPERATION_STARTED || | 1106 OperationRegistry::OPERATION_STARTED || |
| 1107 it->transfer_state == | 1107 it->transfer_state == |
| 1108 GDataOperationRegistry::OPERATION_IN_PROGRESS || | 1108 OperationRegistry::OPERATION_IN_PROGRESS || |
| 1109 it->transfer_state == | 1109 it->transfer_state == |
| 1110 GDataOperationRegistry::OPERATION_SUSPENDED) { | 1110 OperationRegistry::OPERATION_SUSPENDED) { |
| 1111 has_in_progress_items = true; | 1111 has_in_progress_items = true; |
| 1112 break; | 1112 break; |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 if (!has_in_progress_items) { | 1116 if (!has_in_progress_items) { |
| 1117 content::BrowserThread::PostDelayedTask( | 1117 content::BrowserThread::PostDelayedTask( |
| 1118 content::BrowserThread::UI, | 1118 content::BrowserThread::UI, |
| 1119 FROM_HERE, | 1119 FROM_HERE, |
| 1120 base::Bind(&SystemTrayDelegate::RecheckGDataOperations, | 1120 base::Bind(&SystemTrayDelegate::RecheckGDataOperations, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1254 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1255 }; | 1255 }; |
| 1256 | 1256 |
| 1257 } // namespace | 1257 } // namespace |
| 1258 | 1258 |
| 1259 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1259 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
| 1260 return new chromeos::SystemTrayDelegate(tray); | 1260 return new chromeos::SystemTrayDelegate(tray); |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 } // namespace chromeos | 1263 } // namespace chromeos |
| OLD | NEW |