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

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

Issue 2317563004: Change blink::WebScreenInfo to content::ScreenInfo (Closed)
Patch Set: Fix Windows compile Created 4 years, 3 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
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 "content/browser/android/content_view_core_impl.h" 10 #include "content/browser/android/content_view_core_impl.h"
11 #include "content/browser/frame_host/interstitial_page_impl.h" 11 #include "content/browser/frame_host/interstitial_page_impl.h"
12 #include "content/browser/renderer_host/render_widget_host_view_android.h" 12 #include "content/browser/renderer_host/render_widget_host_view_android.h"
13 #include "content/browser/renderer_host/render_view_host_factory.h" 13 #include "content/browser/renderer_host/render_view_host_factory.h"
14 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
15 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/public/browser/render_widget_host.h" 16 #include "content/public/browser/render_widget_host.h"
17 #include "content/public/browser/web_contents_delegate.h" 17 #include "content/public/browser/web_contents_delegate.h"
18 #include "content/public/common/drop_data.h" 18 #include "content/public/common/drop_data.h"
19 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
20 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
21 #include "ui/gfx/android/device_display_info.h" 20 #include "ui/gfx/android/device_display_info.h"
22 #include "ui/gfx/android/java_bitmap.h" 21 #include "ui/gfx/android/java_bitmap.h"
23 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
24 23
25 using base::android::AttachCurrentThread; 24 using base::android::AttachCurrentThread;
26 using base::android::ConvertUTF16ToJavaString; 25 using base::android::ConvertUTF16ToJavaString;
27 using base::android::JavaRef; 26 using base::android::JavaRef;
28 using base::android::ScopedJavaLocalRef; 27 using base::android::ScopedJavaLocalRef;
29 28
30 namespace content { 29 namespace content {
31 30
32 // static 31 // static
33 void WebContentsView::GetDefaultScreenInfo( 32 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
34 blink::WebScreenInfo* results) {
35 const display::Display& display = 33 const display::Display& display =
36 display::Screen::GetScreen()->GetPrimaryDisplay(); 34 display::Screen::GetScreen()->GetPrimaryDisplay();
37 results->rect = display.bounds(); 35 results->rect = display.bounds();
38 // TODO(husky): Remove any system controls from availableRect. 36 // TODO(husky): Remove any system controls from availableRect.
39 results->availableRect = display.work_area(); 37 results->available_rect = display.work_area();
40 results->deviceScaleFactor = display.device_scale_factor(); 38 results->device_scale_factor = display.device_scale_factor();
41 results->orientationAngle = display.RotationAsDegree(); 39 results->orientation_angle = display.RotationAsDegree();
42 results->orientationType = 40 results->orientation_type =
43 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 41 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
44 gfx::DeviceDisplayInfo info; 42 gfx::DeviceDisplayInfo info;
45 results->depth = display.color_depth(); 43 results->depth = display.color_depth();
46 results->depthPerComponent = display.depth_per_component(); 44 results->depth_per_component = display.depth_per_component();
47 results->isMonochrome = (results->depthPerComponent == 0); 45 results->is_monochrome = (results->depth_per_component == 0);
48 } 46 }
49 47
50 WebContentsView* CreateWebContentsView( 48 WebContentsView* CreateWebContentsView(
51 WebContentsImpl* web_contents, 49 WebContentsImpl* web_contents,
52 WebContentsViewDelegate* delegate, 50 WebContentsViewDelegate* delegate,
53 RenderViewHostDelegateView** render_view_host_delegate_view) { 51 RenderViewHostDelegateView** render_view_host_delegate_view) {
54 WebContentsViewAndroid* rv = new WebContentsViewAndroid( 52 WebContentsViewAndroid* rv = new WebContentsViewAndroid(
55 web_contents, delegate); 53 web_contents, delegate);
56 *render_view_host_delegate_view = rv; 54 *render_view_host_delegate_view = rv;
57 return rv; 55 return rv;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return rwhv->GetNativeView(); 96 return rwhv->GetNativeView();
99 97
100 // TODO(sievers): This should return null. 98 // TODO(sievers): This should return null.
101 return GetNativeView(); 99 return GetNativeView();
102 } 100 }
103 101
104 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { 102 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const {
105 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr; 103 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr;
106 } 104 }
107 105
108 void WebContentsViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) const { 106 void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const {
109 // ScreenInfo isn't tied to the widget on Android. Always return the default. 107 // ScreenInfo isn't tied to the widget on Android. Always return the default.
110 WebContentsView::GetDefaultScreenInfo(result); 108 WebContentsView::GetDefaultScreenInfo(result);
111 } 109 }
112 110
113 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { 111 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const {
114 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) 112 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize())
115 : gfx::Rect(); 113 : gfx::Rect();
116 } 114 }
117 115
118 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { 116 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // This is called when we the renderer asks us to take focus back (i.e., it has 308 // This is called when we the renderer asks us to take focus back (i.e., it has
311 // iterated past the last focusable element on the page). 309 // iterated past the last focusable element on the page).
312 void WebContentsViewAndroid::TakeFocus(bool reverse) { 310 void WebContentsViewAndroid::TakeFocus(bool reverse) {
313 if (web_contents_->GetDelegate() && 311 if (web_contents_->GetDelegate() &&
314 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 312 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
315 return; 313 return;
316 web_contents_->GetRenderWidgetHostView()->Focus(); 314 web_contents_->GetRenderWidgetHostView()->Focus();
317 } 315 }
318 316
319 } // namespace content 317 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698