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

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

Issue 2484793002: Remove access to WebContents in RWHVA::SynchronousFrameMetadata() (Closed)
Patch Set: Created 4 years, 1 month 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
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_view_android.h" 5 #include "content/browser/web_contents/web_contents_view_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/gfx/android/java_bitmap.h" 22 #include "ui/gfx/android/java_bitmap.h"
23 #include "ui/gfx/image/image_skia.h" 23 #include "ui/gfx/image/image_skia.h"
24 24
25 using base::android::AttachCurrentThread; 25 using base::android::AttachCurrentThread;
26 using base::android::ConvertUTF16ToJavaString; 26 using base::android::ConvertUTF16ToJavaString;
27 using base::android::JavaRef; 27 using base::android::JavaRef;
28 using base::android::ScopedJavaLocalRef; 28 using base::android::ScopedJavaLocalRef;
29 29
30 namespace content { 30 namespace content {
31 31
32 RenderWidgetHostViewAndroidDelegateImpl::
33 RenderWidgetHostViewAndroidDelegateImpl(WebContentsImpl* web_contents)
34 : web_contents_(web_contents) {}
35
36 bool RenderWidgetHostViewAndroidDelegateImpl::ShowingInterstitialPage() {
37 return web_contents_->ShowingInterstitialPage();
38 }
39
40 scoped_refptr<DevToolsAgentHost>
41 RenderWidgetHostViewAndroidDelegateImpl::GetDevToolsAgentHost() {
42 return DevToolsAgentHost::HasFor(web_contents_) ?
43 DevToolsAgentHost::GetOrCreateFor(web_contents_) : nullptr;
44 }
45
32 // static 46 // static
33 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) { 47 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
34 const display::Display& display = 48 const display::Display& display =
35 display::Screen::GetScreen()->GetPrimaryDisplay(); 49 display::Screen::GetScreen()->GetPrimaryDisplay();
36 results->rect = display.bounds(); 50 results->rect = display.bounds();
37 // TODO(husky): Remove any system controls from availableRect. 51 // TODO(husky): Remove any system controls from availableRect.
38 results->available_rect = display.work_area(); 52 results->available_rect = display.work_area();
39 results->device_scale_factor = display.device_scale_factor(); 53 results->device_scale_factor = display.device_scale_factor();
40 results->orientation_angle = display.RotationAsDegree(); 54 results->orientation_angle = display.RotationAsDegree();
41 results->orientation_type = 55 results->orientation_type =
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 DCHECK(RenderViewHostFactory::has_factory()); 191 DCHECK(RenderViewHostFactory::has_factory());
178 return static_cast<RenderWidgetHostViewBase*>( 192 return static_cast<RenderWidgetHostViewBase*>(
179 render_widget_host->GetView()); 193 render_widget_host->GetView());
180 } 194 }
181 // Note that while this instructs the render widget host to reference 195 // Note that while this instructs the render widget host to reference
182 // |native_view_|, this has no effect without also instructing the 196 // |native_view_|, this has no effect without also instructing the
183 // native view (i.e. ContentView) how to obtain a reference to this widget in 197 // native view (i.e. ContentView) how to obtain a reference to this widget in
184 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an 198 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an
185 // example of how this is achieved for InterstitialPages. 199 // example of how this is achieved for InterstitialPages.
186 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); 200 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host);
187 return new RenderWidgetHostViewAndroid(rwhi, content_view_core_); 201 return new RenderWidgetHostViewAndroid(rwhi, content_view_core_,
202 new RenderWidgetHostViewAndroidDelegateImpl(web_contents_));
188 } 203 }
189 204
190 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( 205 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget(
191 RenderWidgetHost* render_widget_host) { 206 RenderWidgetHost* render_widget_host) {
192 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); 207 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host);
193 return new RenderWidgetHostViewAndroid(rwhi, NULL); 208 return new RenderWidgetHostViewAndroid(rwhi, nullptr, nullptr);
194 } 209 }
195 210
196 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { 211 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) {
197 } 212 }
198 213
199 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { 214 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) {
200 } 215 }
201 216
202 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { 217 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) {
203 } 218 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // This is called when we the renderer asks us to take focus back (i.e., it has 338 // This is called when we the renderer asks us to take focus back (i.e., it has
324 // iterated past the last focusable element on the page). 339 // iterated past the last focusable element on the page).
325 void WebContentsViewAndroid::TakeFocus(bool reverse) { 340 void WebContentsViewAndroid::TakeFocus(bool reverse) {
326 if (web_contents_->GetDelegate() && 341 if (web_contents_->GetDelegate() &&
327 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 342 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
328 return; 343 return;
329 web_contents_->GetRenderWidgetHostView()->Focus(); 344 web_contents_->GetRenderWidgetHostView()->Focus();
330 } 345 }
331 346
332 } // namespace content 347 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698