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

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

Issue 2738063007: Removes unnecessary calls to FocusManager (Closed)
Patch Set: comment 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 | « ui/app_list/views/folder_header_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9d81a013c815d8343473803bb9677f4f3afe4985 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 is not focused automatically when attached, so we need to
+ // tell the WebContents it has focus if this has focus.
+ if (HasFocus())
OnFocus();
OnWebContentsAttached();
« no previous file with comments | « 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