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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.browser.media.remote; 5 package org.chromium.chrome.browser.media.remote;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.net.Uri; 9 import android.net.Uri;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 private Runnable mConnectionFailureNotifier = new Runnable() { 103 private Runnable mConnectionFailureNotifier = new Runnable() {
104 @Override 104 @Override
105 public void run() { 105 public void run() {
106 release(); 106 release();
107 mConnectionFailureNotifierQueued = false; 107 mConnectionFailureNotifierQueued = false;
108 } 108 }
109 }; 109 };
110 110
111 /** True if we are waiting for the MediaRouter route to connect or recon nect */ 111 /** True if we are waiting for the MediaRouter route to connect or recon nect */
112 private boolean mConnectionFailureNotifierQueued = false; 112 private boolean mConnectionFailureNotifierQueued;
113 113
114 private void clearConnectionFailureCallback() { 114 private void clearConnectionFailureCallback() {
115 getHandler().removeCallbacks(mConnectionFailureNotifier); 115 getHandler().removeCallbacks(mConnectionFailureNotifier);
116 mConnectionFailureNotifierQueued = false; 116 mConnectionFailureNotifierQueued = false;
117 } 117 }
118 118
119 @Override 119 @Override
120 public void onRouteChanged(MediaRouter router, RouteInfo route) { 120 public void onRouteChanged(MediaRouter router, RouteInfo route) {
121 // We only care about changes to the current route. 121 // We only care about changes to the current route.
122 if (!route.equals(getCurrentRoute())) return; 122 if (!route.equals(getCurrentRoute())) return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 protected static final long CONNECTION_FAILURE_NOTIFICATION_DELAY_MS = 10000 L; 156 protected static final long CONNECTION_FAILURE_NOTIFICATION_DELAY_MS = 10000 L;
157 private static final long END_OF_VIDEO_THRESHOLD_MS = 500L; 157 private static final long END_OF_VIDEO_THRESHOLD_MS = 500L;
158 private static final String TAG = "MediaFling"; 158 private static final String TAG = "MediaFling";
159 private final Set<MediaStateListener> mAvailableRouteListeners; 159 private final Set<MediaStateListener> mAvailableRouteListeners;
160 private final Context mContext; 160 private final Context mContext;
161 private RouteInfo mCurrentRoute; 161 private RouteInfo mCurrentRoute;
162 private final DeviceDiscoveryCallback mDeviceDiscoveryCallback;; 162 private final DeviceDiscoveryCallback mDeviceDiscoveryCallback;;
163 private final DeviceSelectionCallback mDeviceSelectionCallback; 163 private final DeviceSelectionCallback mDeviceSelectionCallback;
164 164
165 private final Handler mHandler; 165 private final Handler mHandler;
166 private boolean mIsPrepared = false; 166 private boolean mIsPrepared;
167 167
168 private final MediaRouter mMediaRouter; 168 private final MediaRouter mMediaRouter;
169 169
170 private final MediaRouteSelector mMediaRouteSelector; 170 private final MediaRouteSelector mMediaRouteSelector;
171 /** 171 /**
172 * The media state listener connects to the web page that requested casting. It will be null if 172 * The media state listener connects to the web page that requested casting. It will be null if
173 * that page is no longer in a tab, but closing the page or tab should not s top cast. Cast can 173 * that page is no longer in a tab, but closing the page or tab should not s top cast. Cast can
174 * still be controlled through the notification even if the page is closed. 174 * still be controlled through the notification even if the page is closed.
175 */ 175 */
176 private MediaStateListener mMediaStateListener; 176 private MediaStateListener mMediaStateListener;
177 177
178 // There are times when the player state shown to user (e.g. just after pres sing the pause 178 // There are times when the player state shown to user (e.g. just after pres sing the pause
179 // button) should update before we receive an update from the Chromecast, so we have to track 179 // button) should update before we receive an update from the Chromecast, so we have to track
180 // two player states. 180 // two player states.
181 private PlayerState mRemotePlayerState = PlayerState.FINISHED; 181 private PlayerState mRemotePlayerState = PlayerState.FINISHED;
182 private PlayerState mDisplayedPlayerState = PlayerState.FINISHED; 182 private PlayerState mDisplayedPlayerState = PlayerState.FINISHED;
183 private boolean mRoutesAvailable = false; 183 private boolean mRoutesAvailable;
184 private final Set<UiListener> mUiListeners; 184 private final Set<UiListener> mUiListeners;
185 private boolean mWatchingRouteSelection = false; 185 private boolean mWatchingRouteSelection;
186 186
187 private long mMediaElementAttachedTimestampMs = 0; 187 private long mMediaElementAttachedTimestampMs;
188 private long mMediaElementDetachedTimestampMs = 0; 188 private long mMediaElementDetachedTimestampMs;
189 189
190 protected AbstractMediaRouteController() { 190 protected AbstractMediaRouteController() {
191 mContext = ContextUtils.getApplicationContext(); 191 mContext = ContextUtils.getApplicationContext();
192 assert (getContext() != null); 192 assert (getContext() != null);
193 193
194 mHandler = new Handler(); 194 mHandler = new Handler();
195 195
196 mMediaRouteSelector = buildMediaRouteSelector(); 196 mMediaRouteSelector = buildMediaRouteSelector();
197 197
198 MediaRouter mediaRouter; 198 MediaRouter mediaRouter;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 @Override 644 @Override
645 public String getUriPlaying() { 645 public String getUriPlaying() {
646 return null; 646 return null;
647 } 647 }
648 648
649 // Used by J 649 // Used by J
650 void setPreparedForTesting() { 650 void setPreparedForTesting() {
651 mIsPrepared = true; 651 mIsPrepared = true;
652 } 652 }
653 } 653 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698