OLD | NEW |
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.router; | 5 package org.chromium.chrome.browser.media.router; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; |
8 import android.support.v4.app.DialogFragment; | 9 import android.support.v4.app.DialogFragment; |
9 import android.support.v4.app.FragmentActivity; | 10 import android.support.v4.app.FragmentActivity; |
10 import android.support.v4.app.FragmentManager; | 11 import android.support.v4.app.FragmentManager; |
11 import android.support.v7.media.MediaRouter; | 12 import android.support.v7.media.MediaRouter; |
12 import android.view.View; | 13 import android.view.View; |
13 import android.widget.FrameLayout; | 14 import android.widget.FrameLayout; |
14 | 15 |
15 import org.chromium.base.ApplicationStatus; | 16 import org.chromium.base.ApplicationStatus; |
16 import org.chromium.chrome.browser.media.router.cast.MediaSource; | 17 import org.chromium.chrome.browser.media.router.cast.MediaSource; |
17 | 18 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 96 |
96 mDialogFragment.dismiss(); | 97 mDialogFragment.dismiss(); |
97 mDialogFragment = null; | 98 mDialogFragment = null; |
98 } | 99 } |
99 | 100 |
100 @Override | 101 @Override |
101 public boolean isShowingDialog() { | 102 public boolean isShowingDialog() { |
102 return mDialogFragment != null && mDialogFragment.isVisible(); | 103 return mDialogFragment != null && mDialogFragment.isVisible(); |
103 } | 104 } |
104 | 105 |
105 protected BaseMediaRouteDialogManager(MediaSource source, MediaRouteDialogDe
legate delegate) { | 106 protected BaseMediaRouteDialogManager(MediaSource source, Context applicatio
nContext, |
| 107 MediaRouteDialogDelegate delegate) { |
106 mMediaSource = source; | 108 mMediaSource = source; |
107 mAndroidMediaRouter = ChromeMediaRouter.getAndroidMediaRouter(); | 109 mAndroidMediaRouter = ChromeMediaRouter.getAndroidMediaRouter(applicatio
nContext); |
108 mDelegate = delegate; | 110 mDelegate = delegate; |
109 } | 111 } |
110 | 112 |
111 /** | 113 /** |
112 * Initializes and shows the {@link DialogFragment} instance corresponding t
o the dialog type | 114 * Initializes and shows the {@link DialogFragment} instance corresponding t
o the dialog type |
113 * needed. | 115 * needed. |
114 * | 116 * |
115 * @param fm {@link FragmentManager} to use to show the dialog. | 117 * @param fm {@link FragmentManager} to use to show the dialog. |
116 * @return null if the initialization fails, otherwise the initialized dialo
g fragment. | 118 * @return null if the initialization fails, otherwise the initialized dialo
g fragment. |
117 */ | 119 */ |
118 @Nullable | 120 @Nullable |
119 protected abstract DialogFragment openDialogInternal(FragmentManager fm); | 121 protected abstract DialogFragment openDialogInternal(FragmentManager fm); |
120 | 122 |
121 protected MediaRouteDialogDelegate delegate() { | 123 protected MediaRouteDialogDelegate delegate() { |
122 return mDelegate; | 124 return mDelegate; |
123 } | 125 } |
124 | 126 |
125 protected MediaRouter androidMediaRouter() { | 127 protected MediaRouter androidMediaRouter() { |
126 return mAndroidMediaRouter; | 128 return mAndroidMediaRouter; |
127 } | 129 } |
128 | 130 |
129 protected MediaSource mediaSource() { | 131 protected MediaSource mediaSource() { |
130 return mMediaSource; | 132 return mMediaSource; |
131 } | 133 } |
132 } | 134 } |
OLD | NEW |