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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2623483003: Support tracking focused node element for OOPIFs. (Closed)
Patch Set: Added the missing forward declaration Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "content/common/page_state_serialization.h" 87 #include "content/common/page_state_serialization.h"
88 #include "content/common/render_message_filter.mojom.h" 88 #include "content/common/render_message_filter.mojom.h"
89 #include "content/common/site_isolation_policy.h" 89 #include "content/common/site_isolation_policy.h"
90 #include "content/common/view_messages.h" 90 #include "content/common/view_messages.h"
91 #include "content/public/browser/ax_event_notification_details.h" 91 #include "content/public/browser/ax_event_notification_details.h"
92 #include "content/public/browser/browser_context.h" 92 #include "content/public/browser/browser_context.h"
93 #include "content/public/browser/browser_plugin_guest_manager.h" 93 #include "content/public/browser/browser_plugin_guest_manager.h"
94 #include "content/public/browser/content_browser_client.h" 94 #include "content/public/browser/content_browser_client.h"
95 #include "content/public/browser/download_manager.h" 95 #include "content/public/browser/download_manager.h"
96 #include "content/public/browser/download_url_parameters.h" 96 #include "content/public/browser/download_url_parameters.h"
97 #include "content/public/browser/focused_node_details.h"
97 #include "content/public/browser/guest_mode.h" 98 #include "content/public/browser/guest_mode.h"
98 #include "content/public/browser/invalidate_type.h" 99 #include "content/public/browser/invalidate_type.h"
99 #include "content/public/browser/javascript_dialog_manager.h" 100 #include "content/public/browser/javascript_dialog_manager.h"
100 #include "content/public/browser/load_notification_details.h" 101 #include "content/public/browser/load_notification_details.h"
101 #include "content/public/browser/navigation_details.h" 102 #include "content/public/browser/navigation_details.h"
102 #include "content/public/browser/notification_details.h" 103 #include "content/public/browser/notification_details.h"
103 #include "content/public/browser/notification_service.h" 104 #include "content/public/browser/notification_service.h"
104 #include "content/public/browser/notification_types.h" 105 #include "content/public/browser/notification_types.h"
105 #include "content/public/browser/render_widget_host_iterator.h" 106 #include "content/public/browser/render_widget_host_iterator.h"
106 #include "content/public/browser/resource_request_details.h" 107 #include "content/public/browser/resource_request_details.h"
(...skipping 24 matching lines...) Expand all
131 #include "net/url_request/url_request_context_getter.h" 132 #include "net/url_request/url_request_context_getter.h"
132 #include "services/service_manager/public/cpp/interface_provider.h" 133 #include "services/service_manager/public/cpp/interface_provider.h"
133 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" 134 #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
134 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 135 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
135 #include "third_party/skia/include/core/SkBitmap.h" 136 #include "third_party/skia/include/core/SkBitmap.h"
136 #include "ui/accessibility/ax_tree_combiner.h" 137 #include "ui/accessibility/ax_tree_combiner.h"
137 #include "ui/base/layout.h" 138 #include "ui/base/layout.h"
138 #include "ui/events/blink/web_input_event_traits.h" 139 #include "ui/events/blink/web_input_event_traits.h"
139 #include "ui/gl/gl_switches.h" 140 #include "ui/gl/gl_switches.h"
140 141
142 #if defined(OS_WIN)
143 #include "content/browser/renderer_host/dip_util.h"
144 #include "ui/gfx/geometry/dip_util.h"
145 #endif
146
141 #if defined(OS_ANDROID) 147 #if defined(OS_ANDROID)
142 #include "content/browser/android/content_video_view.h" 148 #include "content/browser/android/content_video_view.h"
143 #include "content/browser/android/date_time_chooser_android.h" 149 #include "content/browser/android/date_time_chooser_android.h"
144 #include "content/browser/android/java_interfaces_impl.h" 150 #include "content/browser/android/java_interfaces_impl.h"
145 #include "content/browser/media/android/media_web_contents_observer_android.h" 151 #include "content/browser/media/android/media_web_contents_observer_android.h"
146 #include "content/browser/web_contents/web_contents_android.h" 152 #include "content/browser/web_contents/web_contents_android.h"
147 #endif // OS_ANDROID 153 #endif // OS_ANDROID
148 154
149 #if defined(OS_MACOSX) 155 #if defined(OS_MACOSX)
150 #include "base/mac/foundation_util.h" 156 #include "base/mac/foundation_util.h"
(...skipping 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after
4178 4184
4179 GURL url = pending_entry->GetURL(); 4185 GURL url = pending_entry->GetURL();
4180 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme( 4186 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme(
4181 url.scheme(), net::GetHostOrSpecFromURL(url)); 4187 url.scheme(), net::GetHostOrSpecFromURL(url));
4182 } 4188 }
4183 4189
4184 bool WebContentsImpl::HideDownloadUI() const { 4190 bool WebContentsImpl::HideDownloadUI() const {
4185 return is_overlay_content_; 4191 return is_overlay_content_;
4186 } 4192 }
4187 4193
4194 bool WebContentsImpl::IsFocusedElementEditable() {
4195 RenderFrameHostImpl* frame = GetFocusedFrame();
4196 return frame && frame->has_focused_editable_element();
4197 }
4198
4199 void WebContentsImpl::ClearFocusedElement() {
4200 if (auto* frame = GetFocusedFrame())
4201 frame->ClearFocusedElement();
4202 }
4203
4188 bool WebContentsImpl::IsNeverVisible() { 4204 bool WebContentsImpl::IsNeverVisible() {
4189 if (!delegate_) 4205 if (!delegate_)
4190 return false; 4206 return false;
4191 return delegate_->IsNeverVisible(this); 4207 return delegate_->IsNeverVisible(this);
4192 } 4208 }
4193 4209
4194 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { 4210 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() {
4195 return render_view_host_delegate_view_; 4211 return render_view_host_delegate_view_;
4196 } 4212 }
4197 4213
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) { 4697 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) {
4682 frame_tree_.SetFocusedFrame(node, source); 4698 frame_tree_.SetFocusedFrame(node, source);
4683 return; 4699 return;
4684 } 4700 }
4685 4701
4686 SetAsFocusedWebContentsIfNecessary(); 4702 SetAsFocusedWebContentsIfNecessary();
4687 4703
4688 frame_tree_.SetFocusedFrame(node, source); 4704 frame_tree_.SetFocusedFrame(node, source);
4689 } 4705 }
4690 4706
4707 void WebContentsImpl::OnFocusedElementChangedInFrame(
4708 RenderFrameHostImpl* frame,
4709 const gfx::Rect& bounds_in_root_view) {
4710 RenderWidgetHostViewBase* root_view =
4711 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
4712 if (!root_view || !frame->GetView())
4713 return;
4714
4715 // Converting to screen coordinates.
4716 gfx::Point origin = bounds_in_root_view.origin();
4717 origin += root_view->GetViewBounds().OffsetFromOrigin();
4718 gfx::Rect bounds_in_screen(origin, bounds_in_root_view.size());
4719
4720 root_view->FocusedNodeChanged(frame->has_focused_editable_element(),
4721 bounds_in_screen);
4722
4723 FocusedNodeDetails details = {frame->has_focused_editable_element(),
4724 bounds_in_screen};
4725
4726 // TODO(ekaramad): We should replace this with an observer notification
4727 // (https://crbug.com/675975).
4728 NotificationService::current()->Notify(
4729 NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
4730 Source<RenderViewHost>(GetRenderViewHost()),
4731 Details<FocusedNodeDetails>(&details));
4732 }
4733
4691 bool WebContentsImpl::DidAddMessageToConsole(int32_t level, 4734 bool WebContentsImpl::DidAddMessageToConsole(int32_t level,
4692 const base::string16& message, 4735 const base::string16& message,
4693 int32_t line_no, 4736 int32_t line_no,
4694 const base::string16& source_id) { 4737 const base::string16& source_id) {
4695 if (!delegate_) 4738 if (!delegate_)
4696 return false; 4739 return false;
4697 return delegate_->DidAddMessageToConsole(this, level, message, line_no, 4740 return delegate_->DidAddMessageToConsole(this, level, message, line_no,
4698 source_id); 4741 source_id);
4699 } 4742 }
4700 4743
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
5276 JavaScriptDialogManager* dialog_manager) { 5319 JavaScriptDialogManager* dialog_manager) {
5277 dialog_manager_ = dialog_manager; 5320 dialog_manager_ = dialog_manager;
5278 } 5321 }
5279 5322
5280 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5323 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5281 auto it = binding_sets_.find(interface_name); 5324 auto it = binding_sets_.find(interface_name);
5282 if (it != binding_sets_.end()) 5325 if (it != binding_sets_.end())
5283 binding_sets_.erase(it); 5326 binding_sets_.erase(it);
5284 } 5327 }
5285 5328
5329 void WebContentsImpl::FocusedNodeTouched(bool editable) {
5330 #if defined(OS_WIN)
5331 // We use the cursor position to determine where the touch occurred.
5332 RenderWidgetHostView* view = GetRenderWidgetHostView();
5333 if (!view)
5334 return;
5335 POINT cursor_pos = {};
5336 ::GetCursorPos(&cursor_pos);
5337 float scale = GetScaleFactorForView(view);
5338 gfx::Point location_dips_screen =
5339 gfx::ConvertPointToDIP(scale, gfx::Point(cursor_pos));
5340 view->FocusedNodeTouched(location_dips_screen, editable);
5341 #endif
5342 }
5343
5286 } // namespace content 5344 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698