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

Unified Diff: ui/views/controls/webview/webview.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made View::IsFocusable() non-virtual Created 6 years, 4 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
Index: ui/views/controls/webview/webview.cc
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc
index 630ed48558c77e56bcae8244a15500e38ef2aa29..3e07f6f42322810d6eeceb809167c672b579d282 100644
--- a/ui/views/controls/webview/webview.cc
+++ b/ui/views/controls/webview/webview.cc
@@ -58,6 +58,7 @@ void WebView::SetWebContents(content::WebContents* replacement) {
DetachWebContents();
WebContentsObserver::Observe(replacement);
// web_contents() now returns |replacement| from here onwards.
+ SetFocusable(!!web_contents());
if (wc_owner_ != replacement)
wc_owner_.reset();
if (embed_fullscreen_widget_mode_enabled_) {
@@ -198,12 +199,6 @@ bool WebView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
return web_contents() && !web_contents()->IsCrashed();
}
-bool WebView::IsFocusable() const {
- // We need to be focusable when our contents is not a view hierarchy, as
- // clicking on the contents needs to focus us.
- return !!web_contents();
-}
-
void WebView::OnFocus() {
if (web_contents())
web_contents()->Focus();

Powered by Google App Engine
This is Rietveld 408576698