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

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

Issue 2782263002: Add GetWebContents to ShellDelegate. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 #include "build/build_config.h" 26 #include "build/build_config.h"
27 #include "chrome/browser/app_mode/app_mode_utils.h" 27 #include "chrome/browser/app_mode/app_mode_utils.h"
28 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
29 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 29 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
30 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 30 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
31 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h " 31 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h "
32 #include "chrome/browser/chromeos/ash_config.h" 32 #include "chrome/browser/chromeos/ash_config.h"
33 #include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h" 33 #include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h"
34 #include "chrome/browser/chromeos/display/display_configuration_observer.h" 34 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
35 #include "chrome/browser/chromeos/display/display_preferences.h" 35 #include "chrome/browser/chromeos/display/display_preferences.h"
36 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
37 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
36 #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h" 38 #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h"
37 #include "chrome/browser/chromeos/profiles/profile_helper.h" 39 #include "chrome/browser/chromeos/profiles/profile_helper.h"
38 #include "chrome/browser/chromeos/system/input_device_settings.h" 40 #include "chrome/browser/chromeos/system/input_device_settings.h"
39 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 41 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
40 #include "chrome/browser/lifetime/application_lifetime.h" 42 #include "chrome/browser/lifetime/application_lifetime.h"
41 #include "chrome/browser/profiles/profile.h" 43 #include "chrome/browser/profiles/profile.h"
42 #include "chrome/browser/profiles/profile_manager.h" 44 #include "chrome/browser/profiles/profile_manager.h"
43 #include "chrome/browser/profiles/profiles_state.h" 45 #include "chrome/browser/profiles/profiles_state.h"
44 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" 46 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h"
45 #include "chrome/browser/speech/tts_controller.h" 47 #include "chrome/browser/speech/tts_controller.h"
46 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" 48 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h"
47 #include "chrome/browser/ui/ash/chrome_keyboard_ui.h" 49 #include "chrome/browser/ui/ash/chrome_keyboard_ui.h"
48 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 50 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
49 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 51 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
50 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 52 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
51 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h" 53 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h"
52 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 54 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
53 #include "chrome/browser/ui/ash/session_util.h" 55 #include "chrome/browser/ui/ash/session_util.h"
54 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 56 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
55 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 57 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
56 #include "chrome/browser/ui/browser.h" 58 #include "chrome/browser/ui/browser.h"
57 #include "chrome/browser/ui/browser_commands.h" 59 #include "chrome/browser/ui/browser_commands.h"
58 #include "chrome/browser/ui/browser_finder.h" 60 #include "chrome/browser/ui/browser_finder.h"
61 #include "chrome/browser/ui/browser_list.h"
59 #include "chrome/browser/ui/browser_navigator.h" 62 #include "chrome/browser/ui/browser_navigator.h"
60 #include "chrome/browser/ui/browser_navigator_params.h" 63 #include "chrome/browser/ui/browser_navigator_params.h"
61 #include "chrome/browser/ui/browser_tabstrip.h" 64 #include "chrome/browser/ui/browser_tabstrip.h"
62 #include "chrome/browser/ui/browser_window.h" 65 #include "chrome/browser/ui/browser_window.h"
63 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 66 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
67 #include "chrome/browser/ui/tabs/tab_strip_model.h"
64 #include "chrome/common/pref_names.h" 68 #include "chrome/common/pref_names.h"
65 #include "chrome/grit/chromium_strings.h" 69 #include "chrome/grit/chromium_strings.h"
66 #include "chrome/grit/generated_resources.h" 70 #include "chrome/grit/generated_resources.h"
67 #include "chrome/grit/theme_resources.h" 71 #include "chrome/grit/theme_resources.h"
68 #include "chromeos/chromeos_switches.h" 72 #include "chromeos/chromeos_switches.h"
69 #include "components/prefs/pref_service.h" 73 #include "components/prefs/pref_service.h"
70 #include "components/user_manager/user.h" 74 #include "components/user_manager/user.h"
71 #include "components/user_manager/user_manager.h" 75 #include "components/user_manager/user_manager.h"
72 #include "content/public/browser/notification_service.h" 76 #include "content/public/browser/notification_service.h"
73 #include "content/public/browser/user_metrics.h" 77 #include "content/public/browser/user_metrics.h"
78 #include "content/public/browser/web_contents.h"
74 #include "content/public/common/service_manager_connection.h" 79 #include "content/public/common/service_manager_connection.h"
75 #include "ui/aura/window.h" 80 #include "ui/aura/window.h"
76 #include "ui/base/ime/chromeos/input_method_manager.h" 81 #include "ui/base/ime/chromeos/input_method_manager.h"
77 #include "ui/base/l10n/l10n_util.h" 82 #include "ui/base/l10n/l10n_util.h"
78 #include "ui/base/resource/resource_bundle.h" 83 #include "ui/base/resource/resource_bundle.h"
79 84
80 using chromeos::AccessibilityManager; 85 using chromeos::AccessibilityManager;
81 86
82 namespace { 87 namespace {
83 88
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 547
543 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() { 548 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() {
544 chromeos::system::InputDeviceSettings::Get() 549 chromeos::system::InputDeviceSettings::Get()
545 ->UpdateTouchscreenStatusFromPrefs(); 550 ->UpdateTouchscreenStatusFromPrefs();
546 } 551 }
547 552
548 void ChromeShellDelegate::ToggleTouchpad() { 553 void ChromeShellDelegate::ToggleTouchpad() {
549 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad(); 554 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad();
550 } 555 }
551 556
557 content::WebContents* ChromeShellDelegate::GetWebContents() {
558 BrowserList* browser_list = BrowserList::GetInstance();
559 content::WebContents* webcontents = nullptr;
560 if (!browser_list->empty()) {
561 Browser* browser;
562 browser = browser_list->GetLastActive();
563 if (!browser)
564 browser = browser_list->get(0);
565 if (browser->tab_strip_model()->count() != 0)
566 webcontents = browser->tab_strip_model()->GetActiveWebContents();
567 if (!webcontents)
568 webcontents = browser->tab_strip_model()->GetWebContentsAt(0);
569 } else if (chromeos::LoginDisplayHost::default_host()) {
570 webcontents = chromeos::LoginDisplayHost::default_host()
571 ->GetWebUILoginView()
572 ->GetWebContents();
573 }
574 return webcontents;
575 }
576
552 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() { 577 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() {
553 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile()); 578 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile());
554 } 579 }
555 580
556 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { 581 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
557 return new SessionStateDelegateChromeos; 582 return new SessionStateDelegateChromeos;
558 } 583 }
559 584
560 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { 585 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
561 return new AccessibilityDelegateImpl; 586 return new AccessibilityDelegateImpl;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 NOTREACHED() << "Unexpected notification " << type; 629 NOTREACHED() << "Unexpected notification " << type;
605 } 630 }
606 } 631 }
607 632
608 void ChromeShellDelegate::PlatformInit() { 633 void ChromeShellDelegate::PlatformInit() {
609 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 634 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
610 content::NotificationService::AllSources()); 635 content::NotificationService::AllSources());
611 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, 636 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED,
612 content::NotificationService::AllSources()); 637 content::NotificationService::AllSources());
613 } 638 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698