OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ProfileManager::GetDefaultProfileOrOffTheRecord())-> | 227 ProfileManager::GetDefaultProfileOrOffTheRecord())-> |
228 media_player_event_router()->NotifyTogglePlayState(); | 228 media_player_event_router()->NotifyTogglePlayState(); |
229 } | 229 } |
230 | 230 |
231 void ChromeShellDelegate::HandleMediaPrevTrack() { | 231 void ChromeShellDelegate::HandleMediaPrevTrack() { |
232 extensions::MediaPlayerAPI::Get( | 232 extensions::MediaPlayerAPI::Get( |
233 ProfileManager::GetDefaultProfileOrOffTheRecord())-> | 233 ProfileManager::GetDefaultProfileOrOffTheRecord())-> |
234 media_player_event_router()->NotifyPrevTrack(); | 234 media_player_event_router()->NotifyPrevTrack(); |
235 } | 235 } |
236 | 236 |
| 237 bool ChromeShellDelegate::IsTouchHudProjectionEnabled() const { |
| 238 if (!ProfileManager::IsGetDefaultProfileAllowed()) |
| 239 return false; |
| 240 |
| 241 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 242 if (!profile) |
| 243 return false; |
| 244 |
| 245 PrefService* pref_service = profile->GetPrefs(); |
| 246 return pref_service && |
| 247 pref_service->GetBoolean(prefs::kTouchHudProjectionEnabled); |
| 248 } |
| 249 |
| 250 void ChromeShellDelegate::ToggleTouchHudProjection() { |
| 251 if (!ProfileManager::IsGetDefaultProfileAllowed()) |
| 252 return; |
| 253 |
| 254 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 255 if (!profile) |
| 256 return; |
| 257 |
| 258 PrefService* pref_service = profile->GetPrefs(); |
| 259 if (!pref_service) |
| 260 return; |
| 261 |
| 262 bool enabled = pref_service->GetBoolean(prefs::kTouchHudProjectionEnabled); |
| 263 pref_service->SetBoolean(prefs::kTouchHudProjectionEnabled, !enabled); |
| 264 } |
| 265 |
237 void ChromeShellDelegate::Observe(int type, | 266 void ChromeShellDelegate::Observe(int type, |
238 const content::NotificationSource& source, | 267 const content::NotificationSource& source, |
239 const content::NotificationDetails& details) { | 268 const content::NotificationDetails& details) { |
240 switch (type) { | 269 switch (type) { |
241 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: | 270 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: |
242 ash::Shell::GetInstance()->CreateLauncher(); | 271 ash::Shell::GetInstance()->CreateLauncher(); |
243 break; | 272 break; |
244 case chrome::NOTIFICATION_SESSION_STARTED: | 273 case chrome::NOTIFICATION_SESSION_STARTED: |
245 ash::Shell::GetInstance()->ShowLauncher(); | 274 ash::Shell::GetInstance()->ShowLauncher(); |
246 break; | 275 break; |
247 default: | 276 default: |
248 NOTREACHED() << "Unexpected notification " << type; | 277 NOTREACHED() << "Unexpected notification " << type; |
249 } | 278 } |
250 } | 279 } |
251 | 280 |
252 void ChromeShellDelegate::PlatformInit() { | 281 void ChromeShellDelegate::PlatformInit() { |
253 registrar_.Add(this, | 282 registrar_.Add(this, |
254 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 283 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
255 content::NotificationService::AllSources()); | 284 content::NotificationService::AllSources()); |
256 registrar_.Add(this, | 285 registrar_.Add(this, |
257 chrome::NOTIFICATION_SESSION_STARTED, | 286 chrome::NOTIFICATION_SESSION_STARTED, |
258 content::NotificationService::AllSources()); | 287 content::NotificationService::AllSources()); |
259 } | 288 } |
OLD | NEW |