Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 10837338: Remove "GData" prefix from non-GData specific classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ash/system/brightness/brightness_observer.h" 11 #include "ash/system/brightness/brightness_observer.h"
12 #include "ash/system/date/clock_observer.h" 12 #include "ash/system/date/clock_observer.h"
13 #include "ash/system/drive/drive_observer.h" 13 #include "ash/system/drive/drive_observer.h"
14 #include "ash/system/ime/ime_observer.h" 14 #include "ash/system/ime/ime_observer.h"
15 #include "ash/system/network/network_observer.h" 15 #include "ash/system/network/network_observer.h"
16 #include "ash/system/power/power_status_observer.h" 16 #include "ash/system/power/power_status_observer.h"
17 #include "ash/system/status_area_widget.h" 17 #include "ash/system/status_area_widget.h"
18 #include "ash/system/tray/system_tray.h"
19 #include "ash/system/tray/system_tray_delegate.h"
18 #include "ash/system/tray_accessibility.h" 20 #include "ash/system/tray_accessibility.h"
19 #include "ash/system/tray_caps_lock.h" 21 #include "ash/system/tray_caps_lock.h"
20 #include "ash/system/tray/system_tray_delegate.h"
21 #include "ash/system/tray/system_tray.h"
22 #include "ash/system/user/update_observer.h" 22 #include "ash/system/user/update_observer.h"
23 #include "ash/system/user/user_observer.h" 23 #include "ash/system/user/user_observer.h"
24 #include "ash/volume_control_delegate.h" 24 #include "ash/volume_control_delegate.h"
25 #include "base/bind_helpers.h" 25 #include "base/bind_helpers.h"
26 #include "base/callback.h" 26 #include "base/callback.h"
27 #include "base/chromeos/chromeos_version.h" 27 #include "base/chromeos/chromeos_version.h"
28 #include "base/logging.h" 28 #include "base/logging.h"
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"
52 #include "chrome/browser/chromeos/status/data_promo_notification.h" 52 #include "chrome/browser/chromeos/status/data_promo_notification.h"
53 #include "chrome/browser/chromeos/status/network_menu.h" 53 #include "chrome/browser/chromeos/status/network_menu.h"
54 #include "chrome/browser/chromeos/status/network_menu_icon.h" 54 #include "chrome/browser/chromeos/status/network_menu_icon.h"
55 #include "chrome/browser/chromeos/system/timezone_settings.h"
55 #include "chrome/browser/chromeos/system_key_event_listener.h" 56 #include "chrome/browser/chromeos/system_key_event_listener.h"
56 #include "chrome/browser/chromeos/system/timezone_settings.h"
57 #include "chrome/browser/lifetime/application_lifetime.h" 57 #include "chrome/browser/lifetime/application_lifetime.h"
58 #include "chrome/browser/prefs/pref_service.h" 58 #include "chrome/browser/prefs/pref_service.h"
59 #include "chrome/browser/profiles/profile_manager.h" 59 #include "chrome/browser/profiles/profile_manager.h"
60 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" 60 #include "chrome/browser/ui/ash/volume_controller_chromeos.h"
61 #include "chrome/browser/ui/browser.h"
61 #include "chrome/browser/ui/browser_finder.h" 62 #include "chrome/browser/ui/browser_finder.h"
62 #include "chrome/browser/ui/browser.h"
63 #include "chrome/browser/ui/chrome_pages.h" 63 #include "chrome/browser/ui/chrome_pages.h"
64 #include "chrome/browser/ui/singleton_tabs.h" 64 #include "chrome/browser/ui/singleton_tabs.h"
65 #include "chrome/browser/upgrade_detector.h" 65 #include "chrome/browser/upgrade_detector.h"
66 #include "chrome/common/chrome_notification_types.h" 66 #include "chrome/common/chrome_notification_types.h"
67 #include "chrome/common/pref_names.h" 67 #include "chrome/common/pref_names.h"
68 #include "chrome/common/url_constants.h" 68 #include "chrome/common/url_constants.h"
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;
80 using gdata::GDataSystemService; 79 using gdata::GDataSystemService;
81 using gdata::GDataSystemServiceFactory; 80 using gdata::GDataSystemServiceFactory;
81 using gdata::OperationRegistry;
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;
90 90
91 ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network, 91 ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network,
92 NetworkMenu* network_menu) { 92 NetworkMenu* network_menu) {
93 ash::NetworkIconInfo info; 93 ash::NetworkIconInfo info;
94 info.name = UTF8ToUTF16(network->name()); 94 info.name = UTF8ToUTF16(network->name());
95 info.image = NetworkMenuIcon::GetImage(network, NetworkMenuIcon::COLOR_DARK); 95 info.image = NetworkMenuIcon::GetImage(network, NetworkMenuIcon::COLOR_DARK);
96 info.service_path = network->service_path(); 96 info.service_path = network->service_path();
97 info.highlight = network->connected() || network->connecting(); 97 info.highlight = network->connected() || network->connecting();
98 return info; 98 return info;
99 } 99 }
100 100
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
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/operations_base.cc ('k') | chrome/browser/ui/webui/chromeos/drive_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698