Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 53 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 54 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 54 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
| 55 #include "chrome/browser/ui/browser.h" | 55 #include "chrome/browser/ui/browser.h" |
| 56 #include "chrome/browser/ui/browser_commands.h" | 56 #include "chrome/browser/ui/browser_commands.h" |
| 57 #include "chrome/browser/ui/browser_finder.h" | 57 #include "chrome/browser/ui/browser_finder.h" |
| 58 #include "chrome/browser/ui/browser_navigator.h" | 58 #include "chrome/browser/ui/browser_navigator.h" |
| 59 #include "chrome/browser/ui/browser_navigator_params.h" | 59 #include "chrome/browser/ui/browser_navigator_params.h" |
| 60 #include "chrome/browser/ui/browser_tabstrip.h" | 60 #include "chrome/browser/ui/browser_tabstrip.h" |
| 61 #include "chrome/browser/ui/browser_window.h" | 61 #include "chrome/browser/ui/browser_window.h" |
| 62 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 62 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 63 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | |
| 63 #include "chrome/common/pref_names.h" | 64 #include "chrome/common/pref_names.h" |
| 64 #include "chrome/grit/chromium_strings.h" | 65 #include "chrome/grit/chromium_strings.h" |
| 65 #include "chrome/grit/generated_resources.h" | 66 #include "chrome/grit/generated_resources.h" |
| 66 #include "chrome/grit/theme_resources.h" | 67 #include "chrome/grit/theme_resources.h" |
| 67 #include "chromeos/chromeos_switches.h" | 68 #include "chromeos/chromeos_switches.h" |
| 68 #include "components/prefs/pref_service.h" | 69 #include "components/prefs/pref_service.h" |
| 69 #include "components/user_manager/user.h" | 70 #include "components/user_manager/user.h" |
| 70 #include "components/user_manager/user_manager.h" | 71 #include "components/user_manager/user_manager.h" |
| 72 #include "content/public/browser/media_session.h" | |
| 71 #include "content/public/browser/notification_service.h" | 73 #include "content/public/browser/notification_service.h" |
| 72 #include "content/public/common/service_manager_connection.h" | 74 #include "content/public/common/service_manager_connection.h" |
| 75 #include "media/base/media_switches.h" | |
| 73 #include "ui/aura/window.h" | 76 #include "ui/aura/window.h" |
| 74 #include "ui/base/ime/chromeos/input_method_manager.h" | 77 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 75 #include "ui/base/l10n/l10n_util.h" | 78 #include "ui/base/l10n/l10n_util.h" |
| 76 #include "ui/base/resource/resource_bundle.h" | 79 #include "ui/base/resource/resource_bundle.h" |
| 77 | 80 |
| 78 using chromeos::AccessibilityManager; | 81 using chromeos::AccessibilityManager; |
| 79 | 82 |
| 80 namespace { | 83 namespace { |
| 81 | 84 |
| 82 const char kKeyboardShortcutHelpPageUrl[] = | 85 const char kKeyboardShortcutHelpPageUrl[] = |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 | 459 |
| 457 bool first_run_after_boot = base::CommandLine::ForCurrentProcess()->HasSwitch( | 460 bool first_run_after_boot = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 458 chromeos::switches::kFirstExecAfterBoot); | 461 chromeos::switches::kFirstExecAfterBoot); |
| 459 chromeos::LoadDisplayPreferences(first_run_after_boot); | 462 chromeos::LoadDisplayPreferences(first_run_after_boot); |
| 460 // Object owns itself, and deletes itself when Observer::OnShutdown is called: | 463 // Object owns itself, and deletes itself when Observer::OnShutdown is called: |
| 461 new policy::DisplayRotationDefaultHandler(); | 464 new policy::DisplayRotationDefaultHandler(); |
| 462 // Set the observer now so that we can save the initial state | 465 // Set the observer now so that we can save the initial state |
| 463 // in Shell::Init. | 466 // in Shell::Init. |
| 464 display_configuration_observer_.reset( | 467 display_configuration_observer_.reset( |
| 465 new chromeos::DisplayConfigurationObserver()); | 468 new chromeos::DisplayConfigurationObserver()); |
| 469 | |
| 470 // Append switch for SuspendMediaSessions() that will suspend media players | |
| 471 // without turning on audio focus. | |
| 472 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 473 ::switches::kEnableInternalMediaSession); | |
|
Daniel Erat
2017/05/22 23:38:34
src/content/browser/media/session/media_session_co
Qiang(Joe) Xu
2017/05/23 17:54:46
Done. mlamouri@, do you agree on this?
| |
| 466 } | 474 } |
| 467 | 475 |
| 468 void ChromeShellDelegate::PreShutdown() { | 476 void ChromeShellDelegate::PreShutdown() { |
| 469 display_configuration_observer_.reset(); | 477 display_configuration_observer_.reset(); |
| 470 } | 478 } |
| 471 | 479 |
| 472 void ChromeShellDelegate::Exit() { | 480 void ChromeShellDelegate::Exit() { |
| 473 chrome::AttemptUserExit(); | 481 chrome::AttemptUserExit(); |
| 474 } | 482 } |
| 475 | 483 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 | 591 |
| 584 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() { | 592 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() { |
| 585 chromeos::system::InputDeviceSettings::Get() | 593 chromeos::system::InputDeviceSettings::Get() |
| 586 ->UpdateTouchscreenStatusFromPrefs(); | 594 ->UpdateTouchscreenStatusFromPrefs(); |
| 587 } | 595 } |
| 588 | 596 |
| 589 void ChromeShellDelegate::ToggleTouchpad() { | 597 void ChromeShellDelegate::ToggleTouchpad() { |
| 590 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad(); | 598 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad(); |
| 591 } | 599 } |
| 592 | 600 |
| 601 void ChromeShellDelegate::SuspendMediaSessions() { | |
| 602 for (TabContentsIterator it; !it.done(); it.Next()) { | |
| 603 content::MediaSession::Get(*it)->Suspend( | |
| 604 content::MediaSession::SuspendType::SYSTEM); | |
| 605 } | |
| 606 } | |
| 607 | |
| 593 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() { | 608 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() { |
| 594 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile()); | 609 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile()); |
| 595 } | 610 } |
| 596 | 611 |
| 597 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | 612 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { |
| 598 return new SessionStateDelegateChromeos; | 613 return new SessionStateDelegateChromeos; |
| 599 } | 614 } |
| 600 | 615 |
| 601 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 616 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 602 return new AccessibilityDelegateImpl; | 617 return new AccessibilityDelegateImpl; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 NOTREACHED() << "Unexpected notification " << type; | 660 NOTREACHED() << "Unexpected notification " << type; |
| 646 } | 661 } |
| 647 } | 662 } |
| 648 | 663 |
| 649 void ChromeShellDelegate::PlatformInit() { | 664 void ChromeShellDelegate::PlatformInit() { |
| 650 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 665 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 651 content::NotificationService::AllSources()); | 666 content::NotificationService::AllSources()); |
| 652 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, | 667 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, |
| 653 content::NotificationService::AllSources()); | 668 content::NotificationService::AllSources()); |
| 654 } | 669 } |
| OLD | NEW |