| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.annotation.SuppressLint; |
| 7 import android.app.Activity; | 8 import android.app.Activity; |
| 8 import android.content.Context; | 9 import android.content.Context; |
| 9 import android.content.pm.ApplicationInfo; | 10 import android.content.pm.ApplicationInfo; |
| 10 import android.content.pm.PackageManager; | 11 import android.content.pm.PackageManager; |
| 11 import android.content.pm.PackageManager.NameNotFoundException; | 12 import android.content.pm.PackageManager.NameNotFoundException; |
| 12 import android.graphics.Bitmap; | 13 import android.graphics.Bitmap; |
| 13 import android.os.Bundle; | 14 import android.os.Bundle; |
| 14 import android.support.v4.app.FragmentActivity; | 15 import android.support.v4.app.FragmentActivity; |
| 15 import android.support.v4.app.FragmentManager; | 16 import android.support.v4.app.FragmentManager; |
| 16 import android.support.v7.app.MediaRouteChooserDialogFragment; | 17 import android.support.v7.app.MediaRouteChooserDialogFragment; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 | 31 |
| 31 import java.lang.ref.WeakReference; | 32 import java.lang.ref.WeakReference; |
| 32 import java.util.ArrayList; | 33 import java.util.ArrayList; |
| 33 import java.util.List; | 34 import java.util.List; |
| 34 | 35 |
| 35 /** | 36 /** |
| 36 * The singleton responsible managing the global resources for remote media play
back (cast) | 37 * The singleton responsible managing the global resources for remote media play
back (cast) |
| 37 */ | 38 */ |
| 38 public class RemoteMediaPlayerController implements MediaRouteController.UiListe
ner { | 39 public class RemoteMediaPlayerController implements MediaRouteController.UiListe
ner { |
| 39 // Singleton instance of the class. May only be accessed from UI thread. | 40 // Singleton instance of the class. May only be accessed from UI thread. |
| 41 @SuppressLint("StaticFieldLeak") |
| 40 private static RemoteMediaPlayerController sInstance; | 42 private static RemoteMediaPlayerController sInstance; |
| 41 | 43 |
| 42 private static final String TAG = "MediaFling"; | 44 private static final String TAG = "MediaFling"; |
| 43 | 45 |
| 44 private static final String DEFAULT_CASTING_MESSAGE = "Casting to Chromecast
"; | 46 private static final String DEFAULT_CASTING_MESSAGE = "Casting to Chromecast
"; |
| 45 | 47 |
| 46 private CastNotificationControl mNotificationControl; | 48 private CastNotificationControl mNotificationControl; |
| 47 | 49 |
| 48 private Context mCastContextApplicationContext; | 50 private Context mCastContextApplicationContext; |
| 49 // The Activity that was in the foreground when the video was cast. | 51 // The Activity that was in the foreground when the video was cast. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 mNotificationControl.setRouteController(mCurrentRouteController); | 340 mNotificationControl.setRouteController(mCurrentRouteController); |
| 339 } | 341 } |
| 340 } | 342 } |
| 341 | 343 |
| 342 @VisibleForTesting | 344 @VisibleForTesting |
| 343 static RemoteMediaPlayerController getIfExists() { | 345 static RemoteMediaPlayerController getIfExists() { |
| 344 return sInstance; | 346 return sInstance; |
| 345 } | 347 } |
| 346 | 348 |
| 347 } | 349 } |
| OLD | NEW |