| 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" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { | 151 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { |
| 152 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr; | 152 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const { | 155 void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const { |
| 156 // Since API 17 Android supports multiple displays with different properties. | 156 // Since API 17 Android supports multiple displays with different properties. |
| 157 | 157 |
| 158 gfx::NativeView native_view = GetNativeView(); | 158 gfx::NativeView native_view = GetNativeView(); |
| 159 gfx::NativeWindow native_window = |
| 160 native_view ? native_view->GetWindowAndroid() : nullptr; |
| 159 display::Display display = | 161 display::Display display = |
| 160 native_view | 162 native_view |
| 161 ? display::Screen::GetScreen()->GetDisplayNearestWindow(native_view) | 163 ? display::Screen::GetScreen()->GetDisplayNearestWindow(native_window) |
| 162 : display::Screen::GetScreen()->GetPrimaryDisplay(); | 164 : display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 163 DisplayToScreenInfo(display, result); | 165 DisplayToScreenInfo(display, result); |
| 164 } | 166 } |
| 165 | 167 |
| 166 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { | 168 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { |
| 167 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) | 169 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) |
| 168 : gfx::Rect(); | 170 : gfx::Rect(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { | 173 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // This is called when we the renderer asks us to take focus back (i.e., it has | 391 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 390 // iterated past the last focusable element on the page). | 392 // iterated past the last focusable element on the page). |
| 391 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 393 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 392 if (web_contents_->GetDelegate() && | 394 if (web_contents_->GetDelegate() && |
| 393 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 395 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 394 return; | 396 return; |
| 395 web_contents_->GetRenderWidgetHostView()->Focus(); | 397 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 396 } | 398 } |
| 397 | 399 |
| 398 } // namespace content | 400 } // namespace content |
| OLD | NEW |