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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_common.cc

Issue 636853002: Common code from linux and windows implementations of SystemTrayDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/ash/system_tray_delegate_common.h"
6
7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h"
9 #include "ash/system/tray/system_tray.h"
10 #include "ash/system/tray/system_tray_notifier.h"
11 #include "ash/volume_control_delegate.h"
12 #include "base/time/time.h"
13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h"
17 #include "chrome/browser/ui/chrome_pages.h"
18 #include "chrome/browser/ui/host_desktop.h"
19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
20 #include "chrome/browser/upgrade_detector.h"
21 #include "chrome/grit/locale_settings.h"
22 #include "content/public/browser/notification_service.h"
23 #include "ui/base/l10n/l10n_util.h"
24
25 SystemTrayDelegateCommon::SystemTrayDelegateCommon()
26 : clock_type_(base::GetHourClockType()) {
27 // Register notifications on construction so that events such as
28 // PROFILE_CREATED do not get missed if they happen before Initialize().
29 registrar_.reset(new content::NotificationRegistrar);
30 registrar_->Add(this,
31 chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
32 content::NotificationService::AllSources());
33 }
34
35 SystemTrayDelegateCommon::~SystemTrayDelegateCommon() {
36 registrar_.reset();
37 }
38
39 // Overridden from ash::SystemTrayDelegate:
40 void SystemTrayDelegateCommon::Initialize() {
41 UpdateClockType();
42 }
43
44 void SystemTrayDelegateCommon::Shutdown() {
45 }
46
47 bool SystemTrayDelegateCommon::GetTrayVisibilityOnStartup() {
48 return true;
49 }
50
51 ash::user::LoginStatus SystemTrayDelegateCommon::GetUserLoginStatus() const {
52 return ash::user::LOGGED_IN_OWNER;
53 }
54
55 void SystemTrayDelegateCommon::ChangeProfilePicture() {
56 }
57
58 const std::string SystemTrayDelegateCommon::GetEnterpriseDomain() const {
59 return std::string();
60 }
61
62 const base::string16 SystemTrayDelegateCommon::GetEnterpriseMessage() const {
63 return base::string16();
64 }
65
66 const std::string SystemTrayDelegateCommon::GetSupervisedUserManager() const {
67 return std::string();
68 }
69
70 const base::string16 SystemTrayDelegateCommon::GetSupervisedUserManagerName()
71 const {
72 return base::string16();
73 }
74
75 const base::string16 SystemTrayDelegateCommon::GetSupervisedUserMessage()
76 const {
77 return base::string16();
78 }
79
80 bool SystemTrayDelegateCommon::IsUserSupervised() const {
81 return false;
82 }
83
84 void SystemTrayDelegateCommon::GetSystemUpdateInfo(
85 ash::UpdateInfo* info) const {
86 GetUpdateInfo(UpgradeDetector::GetInstance(), info);
87 }
88
89 base::HourClockType SystemTrayDelegateCommon::GetHourClockType() const {
90 return clock_type_;
91 }
92
93 void SystemTrayDelegateCommon::ShowSettings() {
94 }
95
96 bool SystemTrayDelegateCommon::ShouldShowSettings() {
97 return true;
98 }
99
100 void SystemTrayDelegateCommon::ShowDateSettings() {
101 }
102
103 void SystemTrayDelegateCommon::ShowSetTimeDialog() {
104 }
105
106 void SystemTrayDelegateCommon::ShowNetworkSettings(
107 const std::string& service_path) {
108 }
109
110 void SystemTrayDelegateCommon::ShowBluetoothSettings() {
111 }
112
113 void SystemTrayDelegateCommon::ShowDisplaySettings() {
114 }
115
116 void SystemTrayDelegateCommon::ShowChromeSlow() {
117 #if defined(OS_LINUX)
118 chrome::ScopedTabbedBrowserDisplayer displayer(
119 ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH);
120 chrome::ShowSlow(displayer.browser());
121 #endif // defined(OS_LINUX)
122 }
123
124 bool SystemTrayDelegateCommon::ShouldShowDisplayNotification() {
125 return false;
126 }
127
128 void SystemTrayDelegateCommon::ShowIMESettings() {
129 }
130
131 void SystemTrayDelegateCommon::ShowHelp() {
132 chrome::ShowHelpForProfile(ProfileManager::GetLastUsedProfile(),
133 chrome::HOST_DESKTOP_TYPE_ASH,
134 chrome::HELP_SOURCE_MENU);
135 }
136
137 void SystemTrayDelegateCommon::ShowAccessibilityHelp() {
138 }
139
140 void SystemTrayDelegateCommon::ShowAccessibilitySettings() {
141 }
142
143 void SystemTrayDelegateCommon::ShowPublicAccountInfo() {
144 }
145
146 void SystemTrayDelegateCommon::ShowSupervisedUserInfo() {
147 }
148
149 void SystemTrayDelegateCommon::ShowEnterpriseInfo() {
150 }
151
152 void SystemTrayDelegateCommon::ShowUserLogin() {
153 }
154
155 bool SystemTrayDelegateCommon::ShowSpringChargerReplacementDialog() {
156 return false;
157 }
158
159 bool SystemTrayDelegateCommon::IsSpringChargerReplacementDialogVisible() {
160 return false;
161 }
162
163 bool SystemTrayDelegateCommon::HasUserConfirmedSafeSpringCharger() {
164 return false;
165 }
166
167 void SystemTrayDelegateCommon::ShutDown() {
168 }
169
170 void SystemTrayDelegateCommon::SignOut() {
171 }
172
173 void SystemTrayDelegateCommon::RequestLockScreen() {
174 }
175
176 void SystemTrayDelegateCommon::RequestRestartForUpdate() {
177 chrome::AttemptRestart();
178 }
179
180 void SystemTrayDelegateCommon::GetAvailableBluetoothDevices(
181 ash::BluetoothDeviceList* list) {
182 }
183
184 void SystemTrayDelegateCommon::BluetoothStartDiscovering() {
185 }
186
187 void SystemTrayDelegateCommon::BluetoothStopDiscovering() {
188 }
189
190 void SystemTrayDelegateCommon::ConnectToBluetoothDevice(
191 const std::string& address) {
192 }
193
194 bool SystemTrayDelegateCommon::IsBluetoothDiscovering() {
195 return false;
196 }
197
198 void SystemTrayDelegateCommon::GetCurrentIME(ash::IMEInfo* info) {
199 }
200
201 void SystemTrayDelegateCommon::GetAvailableIMEList(ash::IMEInfoList* list) {
202 }
203
204 void SystemTrayDelegateCommon::GetCurrentIMEProperties(
205 ash::IMEPropertyInfoList* list) {
206 }
207
208 void SystemTrayDelegateCommon::SwitchIME(const std::string& ime_id) {
209 }
210
211 void SystemTrayDelegateCommon::ActivateIMEProperty(const std::string& key) {
212 }
213
214 void SystemTrayDelegateCommon::ShowNetworkConfigure(
215 const std::string& network_id) {
216 }
217
218 bool SystemTrayDelegateCommon::EnrollNetwork(const std::string& network_id) {
219 return true;
220 }
221
222 void SystemTrayDelegateCommon::ManageBluetoothDevices() {
223 }
224
225 void SystemTrayDelegateCommon::ToggleBluetooth() {
226 }
227
228 void SystemTrayDelegateCommon::ShowMobileSimDialog() {
229 }
230
231 void SystemTrayDelegateCommon::ShowMobileSetupDialog(
232 const std::string& service_path) {
233 }
234
235 void SystemTrayDelegateCommon::ShowOtherNetworkDialog(const std::string& type) {
236 }
237
238 bool SystemTrayDelegateCommon::GetBluetoothAvailable() {
239 return false;
240 }
241
242 bool SystemTrayDelegateCommon::GetBluetoothEnabled() {
243 return false;
244 }
245
246 bool SystemTrayDelegateCommon::GetBluetoothDiscovering() {
247 return false;
248 }
249
250 void SystemTrayDelegateCommon::ChangeProxySettings() {
251 }
252
253 ash::VolumeControlDelegate* SystemTrayDelegateCommon::GetVolumeControlDelegate()
254 const {
255 return NULL;
256 }
257
258 void SystemTrayDelegateCommon::SetVolumeControlDelegate(
259 scoped_ptr<ash::VolumeControlDelegate> delegate) {
260 }
261
262 bool SystemTrayDelegateCommon::GetSessionStartTime(
263 base::TimeTicks* session_start_time) {
264 return false;
265 }
266
267 bool SystemTrayDelegateCommon::GetSessionLengthLimit(
268 base::TimeDelta* session_length_limit) {
269 return false;
270 }
271
272 int SystemTrayDelegateCommon::GetSystemTrayMenuWidth() {
273 return l10n_util::GetLocalizedContentsWidthInPixels(
274 IDS_SYSTEM_TRAY_MENU_BUBBLE_WIDTH_PIXELS);
275 }
276
277 void SystemTrayDelegateCommon::ActiveUserWasChanged() {
278 }
279
280 bool SystemTrayDelegateCommon::IsSearchKeyMappedToCapsLock() {
281 return false;
282 }
283
284 ash::tray::UserAccountsDelegate*
285 SystemTrayDelegateCommon::GetUserAccountsDelegate(const std::string& user_id) {
286 return NULL;
287 }
288
289 void SystemTrayDelegateCommon::AddCustodianInfoTrayObserver(
290 ash::CustodianInfoTrayObserver* observer) {
291 }
292
293 void SystemTrayDelegateCommon::RemoveCustodianInfoTrayObserver(
294 ash::CustodianInfoTrayObserver* observer) {
295 }
296
297 ash::SystemTrayNotifier* SystemTrayDelegateCommon::GetSystemTrayNotifier() {
298 return ash::Shell::GetInstance()->system_tray_notifier();
299 }
300
301 void SystemTrayDelegateCommon::UpdateClockType() {
302 clock_type_ = (base::GetHourClockType() == base::k24HourClock)
303 ? base::k24HourClock
304 : base::k12HourClock;
305 GetSystemTrayNotifier()->NotifyDateFormatChanged();
306 }
307
308 void SystemTrayDelegateCommon::Observe(
309 int type,
310 const content::NotificationSource& source,
311 const content::NotificationDetails& details) {
312 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) {
313 ash::UpdateInfo info;
314 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info);
315 GetSystemTrayNotifier()->NotifyUpdateRecommended(info);
316 } else {
317 NOTREACHED();
318 }
319 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_common.h ('k') | chrome/browser/ui/ash/system_tray_delegate_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698