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

Side by Side Diff: ui/android/java/src/org/chromium/ui/display/DisplayAndroid.java

Issue 2420453002: android: Register Display lazily (Closed)
Patch Set: fix typo Created 4 years, 2 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
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/display/DisplayAndroidManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.ui.display; 5 package org.chromium.ui.display;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.graphics.Point; 9 import android.graphics.Point;
10 import android.os.Build; 10 import android.os.Build;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return DisplayAndroidManager.getInstance(); 50 return DisplayAndroidManager.getInstance();
51 } 51 }
52 52
53 /** 53 /**
54 * Get the DisplayAndroid for this context. It's safe to call this with any type of context 54 * Get the DisplayAndroid for this context. It's safe to call this with any type of context
55 * including the Application. However to support multi-display, prefer to us e the Activity 55 * including the Application. However to support multi-display, prefer to us e the Activity
56 * context if available, or obtain DisplayAndroid from WindowAndroid instead . 56 * context if available, or obtain DisplayAndroid from WindowAndroid instead .
57 */ 57 */
58 public static DisplayAndroid get(Context context) { 58 public static DisplayAndroid get(Context context) {
59 Display display = DisplayAndroidManager.getDisplayFromContext(context); 59 Display display = DisplayAndroidManager.getDisplayFromContext(context);
60 int id = display.getDisplayId(); 60 return getManager().getDisplayAndroid(display);
61 return getManager().getDisplayAndroid(id);
62 } 61 }
63 62
64 /** 63 /**
65 * @return Display height in physical pixels. 64 * @return Display height in physical pixels.
66 */ 65 */
67 public int getDisplayHeight() { 66 public int getDisplayHeight() {
68 return mSize.y; 67 return mSize.y;
69 } 68 }
70 69
71 /** 70 /**
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 o.onRotationChanged(mRotation); 161 o.onRotationChanged(mRotation);
163 } 162 }
164 } 163 }
165 } 164 }
166 165
167 private DisplayAndroidObserver[] getObservers() { 166 private DisplayAndroidObserver[] getObservers() {
168 // Makes a copy to allow concurrent edit. 167 // Makes a copy to allow concurrent edit.
169 return mObservers.keySet().toArray(EMPTY_OBSERVER_ARRAY); 168 return mObservers.keySet().toArray(EMPTY_OBSERVER_ARRAY);
170 } 169 }
171 } 170 }
OLDNEW
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/display/DisplayAndroidManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698