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

Unified Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 2782263002: Add GetWebContents to ShellDelegate. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/chrome_shell_delegate.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 47131b00f9ffbf367f9103f8fee8b7aafc3a0fac..2762b77882a145986454d527daff808184ef706d 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -33,6 +33,8 @@
#include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h"
#include "chrome/browser/chromeos/display/display_configuration_observer.h"
#include "chrome/browser/chromeos/display/display_preferences.h"
+#include "chrome/browser/chromeos/login/ui/login_display_host.h"
+#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include "chrome/browser/chromeos/policy/display_rotation_default_handler.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/system/input_device_settings.h"
@@ -56,11 +58,13 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -71,6 +75,7 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/common/service_manager_connection.h"
#include "ui/aura/window.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
@@ -549,6 +554,26 @@ void ChromeShellDelegate::ToggleTouchpad() {
chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad();
}
+content::WebContents* ChromeShellDelegate::GetWebContents() {
+ BrowserList* browser_list = BrowserList::GetInstance();
+ content::WebContents* webcontents = nullptr;
+ if (!browser_list->empty()) {
+ Browser* browser;
+ browser = browser_list->GetLastActive();
+ if (!browser)
+ browser = browser_list->get(0);
+ if (browser->tab_strip_model()->count() != 0)
+ webcontents = browser->tab_strip_model()->GetActiveWebContents();
+ if (!webcontents)
+ webcontents = browser->tab_strip_model()->GetWebContentsAt(0);
+ } else if (chromeos::LoginDisplayHost::default_host()) {
+ webcontents = chromeos::LoginDisplayHost::default_host()
+ ->GetWebUILoginView()
+ ->GetWebContents();
+ }
+ return webcontents;
+}
+
keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() {
return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile());
}
« 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