OLD | NEW |
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" |
11 #include "content/browser/android/content_view_core_impl.h" | 11 #include "content/browser/android/content_view_core_impl.h" |
12 #include "content/browser/frame_host/interstitial_page_impl.h" | 12 #include "content/browser/frame_host/interstitial_page_impl.h" |
13 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 13 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
14 #include "content/browser/renderer_host/render_view_host_factory.h" | 14 #include "content/browser/renderer_host/render_view_host_factory.h" |
15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
16 #include "content/browser/web_contents/web_contents_impl.h" | 16 #include "content/browser/web_contents/web_contents_impl.h" |
17 #include "content/public/browser/render_widget_host.h" | 17 #include "content/public/browser/render_widget_host.h" |
18 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
19 #include "content/public/common/drop_data.h" | 19 #include "content/public/common/drop_data.h" |
20 #include "ui/android/overscroll_refresh_handler.h" | 20 #include "ui/android/overscroll_refresh_handler.h" |
21 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
22 #include "ui/gfx/android/device_display_info.h" | |
23 #include "ui/gfx/android/java_bitmap.h" | 22 #include "ui/gfx/android/java_bitmap.h" |
24 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
25 | 24 |
26 using base::android::AttachCurrentThread; | 25 using base::android::AttachCurrentThread; |
27 using base::android::ConvertUTF16ToJavaString; | 26 using base::android::ConvertUTF16ToJavaString; |
28 using base::android::JavaRef; | 27 using base::android::JavaRef; |
29 using base::android::ScopedJavaLocalRef; | 28 using base::android::ScopedJavaLocalRef; |
30 | 29 |
31 namespace content { | 30 namespace content { |
32 | 31 |
33 namespace { | 32 namespace { |
34 void DisplayToScreenInfo(const display::Display& display, ScreenInfo* results) { | 33 void DisplayToScreenInfo(const display::Display& display, ScreenInfo* results) { |
35 results->rect = display.bounds(); | 34 results->rect = display.bounds(); |
36 // TODO(husky): Remove any system controls from availableRect. | 35 // TODO(husky): Remove any system controls from availableRect. |
37 results->available_rect = display.work_area(); | 36 results->available_rect = display.work_area(); |
38 results->device_scale_factor = display.device_scale_factor(); | 37 results->device_scale_factor = display.device_scale_factor(); |
39 results->orientation_angle = display.RotationAsDegree(); | 38 results->orientation_angle = display.RotationAsDegree(); |
40 results->orientation_type = | 39 results->orientation_type = |
41 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 40 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
42 gfx::DeviceDisplayInfo info; | |
43 results->depth = display.color_depth(); | 41 results->depth = display.color_depth(); |
44 results->depth_per_component = display.depth_per_component(); | 42 results->depth_per_component = display.depth_per_component(); |
45 results->is_monochrome = display.is_monochrome(); | 43 results->is_monochrome = display.is_monochrome(); |
46 } | 44 } |
47 } | 45 } |
48 | 46 |
49 // static | 47 // static |
50 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) { | 48 void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) { |
51 DisplayToScreenInfo(display::Screen::GetScreen()->GetPrimaryDisplay(), | 49 DisplayToScreenInfo(display::Screen::GetScreen()->GetPrimaryDisplay(), |
52 results); | 50 results); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // This is called when we the renderer asks us to take focus back (i.e., it has | 395 // This is called when we the renderer asks us to take focus back (i.e., it has |
398 // iterated past the last focusable element on the page). | 396 // iterated past the last focusable element on the page). |
399 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 397 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
400 if (web_contents_->GetDelegate() && | 398 if (web_contents_->GetDelegate() && |
401 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 399 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
402 return; | 400 return; |
403 web_contents_->GetRenderWidgetHostView()->Focus(); | 401 web_contents_->GetRenderWidgetHostView()->Focus(); |
404 } | 402 } |
405 | 403 |
406 } // namespace content | 404 } // namespace content |
OLD | NEW |