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

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