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

Unified Diff: chrome/browser/chromeos/login/ui/webui_login_view.h

Issue 2512473004: cros: Enable WebUILoginView reuse. (Closed)
Patch Set: Initial upload Created 4 years 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
Index: chrome/browser/chromeos/login/ui/webui_login_view.h
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.h b/chrome/browser/chromeos/login/ui/webui_login_view.h
index 5fbd2c7b2e62852ac114824ed3307ddcf2bc9b0d..79d77ab4da66fe3476554d7556384ea9588f5441 100644
--- a/chrome/browser/chromeos/login/ui/webui_login_view.h
+++ b/chrome/browser/chromeos/login/ui/webui_login_view.h
@@ -34,6 +34,7 @@ class Widget;
namespace chromeos {
class OobeUI;
+class SharedWebViewUsageHandle;
// View used to render a WebUI supporting Widget. This widget is used for the
// WebUI based start up and lock screens. It contains a WebView.
@@ -43,10 +44,15 @@ class WebUILoginView : public views::View,
public ChromeWebModalDialogManagerDelegate,
public web_modal::WebContentsModalDialogHost {
public:
+ struct WebViewSettings {
+ // URL of the WebView to preload and reuse across WebUILoginView instances.
+ GURL preloaded_url;
xiyuan 2016/12/09 22:37:30 nit: #include "url/gurl.h" and get rid of forward
jdufault 2016/12/12 18:23:09 Done.
+ };
+
// Internal class name.
static const char kViewClassName[];
- WebUILoginView();
+ explicit WebUILoginView(const WebViewSettings& settings);
~WebUILoginView() override;
// Initializes the webui login view.
@@ -105,6 +111,8 @@ class WebUILoginView : public views::View,
}
protected:
+ static void InitializeWebView(views::WebView* web_view);
xiyuan 2016/12/09 22:37:30 nit: no need to expose this in header, put it in t
jdufault 2016/12/12 18:23:09 This is needed for preloading the webview (done in
+
// Overridden from views::View:
void Layout() override;
void OnLocaleChanged() override;
@@ -148,6 +156,15 @@ class WebUILoginView : public views::View,
content::NotificationRegistrar registrar_;
+ // WebView configuration options.
+ WebViewSettings settings_;
xiyuan 2016/12/09 22:37:30 nit: const WebViewSettings if we don't need to cha
jdufault 2016/12/12 18:23:09 Done.
+
+ // True if the current webview instance (ie, GetWebUI()) has been reused.
+ bool is_reusing_webview_ = false;
+
+ // Prevents the webview from being destroyed while it is in use.
+ std::unique_ptr<SharedWebViewUsageHandle> webview_usage_handle_;
+
// Converts keyboard events on the WebContents to accelerators.
views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;

Powered by Google App Engine
This is Rietveld 408576698