OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/android/display_android_manager.h" | 5 #include "ui/android/display_android_manager.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 return RegisterNativesImpl(env); | 35 return RegisterNativesImpl(env); |
36 } | 36 } |
37 | 37 |
38 DisplayAndroidManager::DisplayAndroidManager() {} | 38 DisplayAndroidManager::DisplayAndroidManager() {} |
39 | 39 |
40 DisplayAndroidManager::~DisplayAndroidManager() {} | 40 DisplayAndroidManager::~DisplayAndroidManager() {} |
41 | 41 |
42 // Screen interface. | 42 // Screen interface. |
43 | 43 |
44 Display DisplayAndroidManager::GetDisplayNearestWindow( | 44 Display DisplayAndroidManager::GetDisplayNearestWindow( |
45 gfx::NativeView view) const { | 45 gfx::NativeWindow window) const { |
46 ui::WindowAndroid* window = view ? view->GetWindowAndroid() : nullptr; | |
47 if (window) { | 46 if (window) { |
48 DisplayList::Displays::const_iterator it = | 47 DisplayList::Displays::const_iterator it = |
49 display_list().FindDisplayById(window->display_id()); | 48 display_list().FindDisplayById(window->display_id()); |
50 if (it != display_list().displays().end()) { | 49 if (it != display_list().displays().end()) { |
51 return *it; | 50 return *it; |
52 } | 51 } |
53 } | 52 } |
54 return GetPrimaryDisplay(); | 53 return GetPrimaryDisplay(); |
55 } | 54 } |
56 | 55 |
| 56 Display DisplayAndroidManager::GetDisplayNearestView( |
| 57 gfx::NativeView view) const { |
| 58 return GetDisplayNearestWindow(view ? view->GetWindowAndroid() : nullptr); |
| 59 } |
| 60 |
57 // There is no notion of relative display positions on Android. | 61 // There is no notion of relative display positions on Android. |
58 Display DisplayAndroidManager::GetDisplayNearestPoint( | 62 Display DisplayAndroidManager::GetDisplayNearestPoint( |
59 const gfx::Point& point) const { | 63 const gfx::Point& point) const { |
60 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
61 return GetPrimaryDisplay(); | 65 return GetPrimaryDisplay(); |
62 } | 66 } |
63 | 67 |
64 // There is no notion of relative display positions on Android. | 68 // There is no notion of relative display positions on Android. |
65 Display DisplayAndroidManager::GetDisplayMatching( | 69 Display DisplayAndroidManager::GetDisplayMatching( |
66 const gfx::Rect& match_rect) const { | 70 const gfx::Rect& match_rect) const { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 116 } |
113 | 117 |
114 void DisplayAndroidManager::SetPrimaryDisplayId( | 118 void DisplayAndroidManager::SetPrimaryDisplayId( |
115 JNIEnv* env, | 119 JNIEnv* env, |
116 const base::android::JavaParamRef<jobject>& jobject, | 120 const base::android::JavaParamRef<jobject>& jobject, |
117 jint sdkDisplayId) { | 121 jint sdkDisplayId) { |
118 primary_display_id_ = sdkDisplayId; | 122 primary_display_id_ = sdkDisplayId; |
119 } | 123 } |
120 | 124 |
121 } // namespace ui | 125 } // namespace ui |
OLD | NEW |