| 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 26 matching lines...) Expand all Loading... |
| 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::NativeView view) const { |
| 46 ui::WindowAndroid* window = view ? view->GetWindowAndroid() : nullptr; | 46 ui::WindowAndroid* window = view ? view->GetWindowAndroid() : nullptr; |
| 47 return GetDisplayNearestWindowAndroid(window); |
| 48 } |
| 49 |
| 50 Display DisplayAndroidManager::GetDisplayNearestWindowAndroid( |
| 51 gfx::NativeWindow window) const { |
| 47 if (window) { | 52 if (window) { |
| 48 DisplayList::Displays::const_iterator it = | 53 DisplayList::Displays::const_iterator it = |
| 49 display_list().FindDisplayById(window->display_id()); | 54 display_list().FindDisplayById(window->display_id()); |
| 50 if (it != display_list().displays().end()) { | 55 if (it != display_list().displays().end()) { |
| 51 return *it; | 56 return *it; |
| 52 } | 57 } |
| 53 } | 58 } |
| 54 return GetPrimaryDisplay(); | 59 return GetPrimaryDisplay(); |
| 55 } | 60 } |
| 56 | 61 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 117 } |
| 113 | 118 |
| 114 void DisplayAndroidManager::SetPrimaryDisplayId( | 119 void DisplayAndroidManager::SetPrimaryDisplayId( |
| 115 JNIEnv* env, | 120 JNIEnv* env, |
| 116 const base::android::JavaParamRef<jobject>& jobject, | 121 const base::android::JavaParamRef<jobject>& jobject, |
| 117 jint sdkDisplayId) { | 122 jint sdkDisplayId) { |
| 118 primary_display_id_ = sdkDisplayId; | 123 primary_display_id_ = sdkDisplayId; |
| 119 } | 124 } |
| 120 | 125 |
| 121 } // namespace ui | 126 } // namespace ui |
| OLD | NEW |