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/ui/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/host/root_window_host_factory.h" | 7 #include "ash/host/root_window_host_factory.h" |
8 #include "ash/launcher/launcher_types.h" | 8 #include "ash/launcher/launcher_types.h" |
9 #include "ash/magnifier/magnifier_constants.h" | 9 #include "ash/magnifier/magnifier_constants.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
44 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
45 #include "ui/aura/client/user_action_client.h" | 45 #include "ui/aura/client/user_action_client.h" |
46 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
47 | 47 |
48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
49 #include "ash/keyboard_overlay/keyboard_overlay_view.h" | 49 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
50 #include "base/chromeos/chromeos_version.h" | 50 #include "base/chromeos/chromeos_version.h" |
51 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 51 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
52 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 52 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
53 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | |
54 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 53 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
55 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 54 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
56 #include "chrome/browser/chromeos/login/user_manager.h" | 55 #include "chrome/browser/chromeos/login/user_manager.h" |
57 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 56 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
58 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 57 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
59 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 58 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
60 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 59 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
61 #include "chromeos/dbus/dbus_thread_manager.h" | 60 #include "chromeos/dbus/dbus_thread_manager.h" |
62 #include "chromeos/dbus/power_manager_client.h" | 61 #include "chromeos/dbus/power_manager_client.h" |
63 #include "chromeos/dbus/session_manager_client.h" | 62 #include "chromeos/dbus/session_manager_client.h" |
64 #endif | 63 #endif |
65 | 64 |
| 65 #if defined(OS_CHROMEOS) && defined(FILE_MANAGER_EXTENSION) |
| 66 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 67 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 68 #endif |
| 69 |
66 namespace { | 70 namespace { |
67 | 71 |
68 // Returns the browser that should handle accelerators. | 72 // Returns the browser that should handle accelerators. |
69 Browser* GetTargetBrowser() { | 73 Browser* GetTargetBrowser() { |
70 Browser* browser = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 74 Browser* browser = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
71 if (browser) | 75 if (browser) |
72 return browser; | 76 return browser; |
73 return browser::FindOrCreateTabbedBrowser( | 77 return browser::FindOrCreateTabbedBrowser( |
74 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 78 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
75 chrome::HOST_DESKTOP_TYPE_ASH); | 79 chrome::HOST_DESKTOP_TYPE_ASH); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 content::UserMetricsAction("Accel_KeyboardBrightnessDown_F6")); | 488 content::UserMetricsAction("Accel_KeyboardBrightnessDown_F6")); |
485 break; | 489 break; |
486 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7: | 490 case ash::UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7: |
487 content::RecordAction( | 491 content::RecordAction( |
488 content::UserMetricsAction("Accel_KeyboardBrightnessUp_F7")); | 492 content::UserMetricsAction("Accel_KeyboardBrightnessUp_F7")); |
489 break; | 493 break; |
490 } | 494 } |
491 } | 495 } |
492 | 496 |
493 void ChromeShellDelegate::HandleMediaNextTrack() { | 497 void ChromeShellDelegate::HandleMediaNextTrack() { |
494 #if defined(OS_CHROMEOS) | 498 #if defined(OS_CHROMEOS) && defined(FILE_MANAGER_EXTENSION) |
495 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyNextTrack(); | 499 extensions::MediaPlayerAPI::Get(GetTargetBrowser()->profile())-> |
| 500 media_player_event_router()->NotifyNextTrack(); |
496 #endif | 501 #endif |
497 } | 502 } |
498 | 503 |
499 void ChromeShellDelegate::HandleMediaPlayPause() { | 504 void ChromeShellDelegate::HandleMediaPlayPause() { |
500 #if defined(OS_CHROMEOS) | 505 #if defined(OS_CHROMEOS) && defined(FILE_MANAGER_EXTENSION) |
501 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyTogglePlayState(); | 506 extensions::MediaPlayerAPI::Get(GetTargetBrowser()->profile())-> |
| 507 media_player_event_router()->NotifyTogglePlayState(); |
502 #endif | 508 #endif |
503 } | 509 } |
504 | 510 |
505 void ChromeShellDelegate::HandleMediaPrevTrack() { | 511 void ChromeShellDelegate::HandleMediaPrevTrack() { |
506 #if defined(OS_CHROMEOS) | 512 #if defined(OS_CHROMEOS) && defined(FILE_MANAGER_EXTENSION) |
507 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPrevTrack(); | 513 extensions::MediaPlayerAPI::Get(GetTargetBrowser()->profile())-> |
| 514 media_player_event_router()->NotifyPrevTrack(); |
508 #endif | 515 #endif |
509 } | 516 } |
510 | 517 |
511 string16 ChromeShellDelegate::GetTimeRemainingString(base::TimeDelta delta) { | 518 string16 ChromeShellDelegate::GetTimeRemainingString(base::TimeDelta delta) { |
512 return TimeFormat::TimeRemainingLong(delta); | 519 return TimeFormat::TimeRemainingLong(delta); |
513 } | 520 } |
514 | 521 |
515 string16 ChromeShellDelegate::GetTimeDurationLongString(base::TimeDelta delta) { | 522 string16 ChromeShellDelegate::GetTimeDurationLongString(base::TimeDelta delta) { |
516 return TimeFormat::TimeDurationLong(delta); | 523 return TimeFormat::TimeDurationLong(delta); |
517 } | 524 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 ash::Shell::GetInstance()->ShowLauncher(); | 564 ash::Shell::GetInstance()->ShowLauncher(); |
558 break; | 565 break; |
559 default: | 566 default: |
560 NOTREACHED() << "Unexpected notification " << type; | 567 NOTREACHED() << "Unexpected notification " << type; |
561 } | 568 } |
562 #else | 569 #else |
563 // MSVC++ warns about switch statements without any cases. | 570 // MSVC++ warns about switch statements without any cases. |
564 NOTREACHED() << "Unexpected notification " << type; | 571 NOTREACHED() << "Unexpected notification " << type; |
565 #endif | 572 #endif |
566 } | 573 } |
OLD | NEW |