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