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" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "jni/DisplayAndroidManager_jni.h" | 12 #include "jni/DisplayAndroidManager_jni.h" |
13 #include "ui/android/screen_android.h" | 13 #include "ui/android/screen_android.h" |
| 14 #include "ui/android/view_android.h" |
14 #include "ui/android/window_android.h" | 15 #include "ui/android/window_android.h" |
15 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 | 19 |
19 using base::android::AttachCurrentThread; | 20 using base::android::AttachCurrentThread; |
20 using display::Display; | 21 using display::Display; |
21 using display::DisplayList; | 22 using display::DisplayList; |
22 | 23 |
23 void SetScreenAndroid() { | 24 void SetScreenAndroid() { |
(...skipping 13 matching lines...) Expand all Loading... |
37 | 38 |
38 DisplayAndroidManager::DisplayAndroidManager() {} | 39 DisplayAndroidManager::DisplayAndroidManager() {} |
39 | 40 |
40 DisplayAndroidManager::~DisplayAndroidManager() {} | 41 DisplayAndroidManager::~DisplayAndroidManager() {} |
41 | 42 |
42 // Screen interface. | 43 // Screen interface. |
43 | 44 |
44 Display DisplayAndroidManager::GetDisplayNearestWindow( | 45 Display DisplayAndroidManager::GetDisplayNearestWindow( |
45 gfx::NativeView view) const { | 46 gfx::NativeView view) const { |
46 ui::WindowAndroid* window = view ? view->GetWindowAndroid() : nullptr; | 47 ui::WindowAndroid* window = view ? view->GetWindowAndroid() : nullptr; |
| 48 return GetDisplayNearestWindowAndroid(window); |
| 49 } |
| 50 |
| 51 Display DisplayAndroidManager::GetDisplayNearestWindowAndroid( |
| 52 gfx::NativeWindow window) const { |
47 if (window) { | 53 if (window) { |
48 DisplayList::Displays::const_iterator it = | 54 DisplayList::Displays::const_iterator it = |
49 display_list().FindDisplayById(window->display_id()); | 55 display_list().FindDisplayById(window->display_id()); |
50 if (it != display_list().displays().end()) { | 56 if (it != display_list().displays().end()) { |
51 return *it; | 57 return *it; |
52 } | 58 } |
53 } | 59 } |
54 return GetPrimaryDisplay(); | 60 return GetPrimaryDisplay(); |
55 } | 61 } |
56 | 62 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 118 } |
113 | 119 |
114 void DisplayAndroidManager::SetPrimaryDisplayId( | 120 void DisplayAndroidManager::SetPrimaryDisplayId( |
115 JNIEnv* env, | 121 JNIEnv* env, |
116 const base::android::JavaParamRef<jobject>& jobject, | 122 const base::android::JavaParamRef<jobject>& jobject, |
117 jint sdkDisplayId) { | 123 jint sdkDisplayId) { |
118 primary_display_id_ = sdkDisplayId; | 124 primary_display_id_ = sdkDisplayId; |
119 } | 125 } |
120 | 126 |
121 } // namespace ui | 127 } // namespace ui |
OLD | NEW |