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

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

Issue 2751833004: Reland "Add display::GetDisplayNearestView" (Closed)
Patch Set: Created 3 years, 9 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 "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const { 152 gfx::NativeWindow WebContentsViewAndroid::GetTopLevelNativeWindow() const {
153 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr; 153 return content_view_core_ ? content_view_core_->GetWindowAndroid() : nullptr;
154 } 154 }
155 155
156 void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const { 156 void WebContentsViewAndroid::GetScreenInfo(ScreenInfo* result) const {
157 // Since API 17 Android supports multiple displays with different properties. 157 // Since API 17 Android supports multiple displays with different properties.
158 158
159 gfx::NativeView native_view = GetNativeView(); 159 gfx::NativeView native_view = GetNativeView();
160 display::Display display = 160 display::Display display =
161 native_view 161 native_view
162 ? display::Screen::GetScreen()->GetDisplayNearestWindow(native_view) 162 ? display::Screen::GetScreen()->GetDisplayNearestView(native_view)
163 : display::Screen::GetScreen()->GetPrimaryDisplay(); 163 : display::Screen::GetScreen()->GetPrimaryDisplay();
164 DisplayToScreenInfo(display, result); 164 DisplayToScreenInfo(display, result);
165 } 165 }
166 166
167 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const { 167 void WebContentsViewAndroid::GetContainerBounds(gfx::Rect* out) const {
168 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize()) 168 *out = content_view_core_ ? gfx::Rect(content_view_core_->GetViewSize())
169 : gfx::Rect(); 169 : gfx::Rect();
170 } 170 }
171 171
172 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) { 172 void WebContentsViewAndroid::SetPageTitle(const base::string16& title) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 bool WebContentsViewAndroid::OnTouchEvent(const ui::MotionEventAndroid& event, 399 bool WebContentsViewAndroid::OnTouchEvent(const ui::MotionEventAndroid& event,
400 bool for_touch_handle) { 400 bool for_touch_handle) {
401 if (event.GetAction() == ui::MotionEventAndroid::ACTION_DOWN) 401 if (event.GetAction() == ui::MotionEventAndroid::ACTION_DOWN)
402 content_view_core_->OnTouchDown(event.GetJavaObject()); 402 content_view_core_->OnTouchDown(event.GetJavaObject());
403 return false; // let the children handle the actual event. 403 return false; // let the children handle the actual event.
404 } 404 }
405 405
406 } // namespace content 406 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/browser/web_contents/web_contents_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698