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

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

Issue 2738063007: Removes unnecessary calls to FocusManager (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
Index: ui/views/controls/webview/webview.cc
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc
index 6eb474020e9a4f4ef369cec93f01d1d4017acd42..ea8e875f29437aa35f88f262cb25720e08907bdd 100644
--- a/ui/views/controls/webview/webview.cc
+++ b/ui/views/controls/webview/webview.cc
@@ -271,8 +271,7 @@ void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) {
void WebView::RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {
- FocusManager* const focus_manager = GetFocusManager();
- if (focus_manager && focus_manager->GetFocusedView() == this)
+ if (HasFocus())
OnFocus();
NotifyAccessibilityWebContentsChanged();
}
@@ -310,9 +309,7 @@ void WebView::DidDetachInterstitialPage() {
}
void WebView::OnWebContentsFocused() {
- FocusManager* focus_manager = GetFocusManager();
- if (focus_manager)
- focus_manager->SetFocusedView(this);
+ RequestFocus();
}
////////////////////////////////////////////////////////////////////////////////
@@ -333,11 +330,9 @@ void WebView::AttachWebContents() {
holder_->Attach(view_to_attach);
- // The view will not be focused automatically when it is attached, so we need
- // to pass on focus to it if the FocusManager thinks the view is focused. Note
- // that not every Widget has a focus manager.
- FocusManager* const focus_manager = GetFocusManager();
- if (focus_manager && focus_manager->GetFocusedView() == this)
+ // The WebContents will not be focused automatically when it is attached, so
+ // we need to pass on focus to if focused.
msw 2017/03/10 17:47:08 nit: clarify 'pass on focus to if focused'?
sky 2017/03/10 18:06:11 Done.
+ if (HasFocus())
OnFocus();
OnWebContentsAttached();
« ui/app_list/views/folder_header_view.cc ('K') | « ui/app_list/views/folder_header_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698