| 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 #ifndef CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDRO
ID_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDRO
ID_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDRO
ID_H_ | 6 #define CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDRO
ID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 13 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
| 14 #include "chrome/browser/media/router/media_routes_observer.h" | |
| 15 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 16 | 15 |
| 17 namespace media_router { | 16 namespace media_router { |
| 18 | 17 |
| 19 // Android implementation of the MediaRouterDialogController. | 18 // Android implementation of the MediaRouterDialogController. |
| 20 class MediaRouterDialogControllerAndroid | 19 class MediaRouterDialogControllerAndroid |
| 21 : public content::WebContentsUserData<MediaRouterDialogControllerAndroid>, | 20 : public content::WebContentsUserData<MediaRouterDialogControllerAndroid>, |
| 22 public MediaRouterDialogController, | 21 public MediaRouterDialogController { |
| 23 public MediaRoutesObserver { | |
| 24 public: | 22 public: |
| 25 ~MediaRouterDialogControllerAndroid() override; | 23 ~MediaRouterDialogControllerAndroid() override; |
| 26 | 24 |
| 27 static bool Register(JNIEnv* env); | 25 static bool Register(JNIEnv* env); |
| 28 | 26 |
| 29 static MediaRouterDialogControllerAndroid* GetOrCreateForWebContents( | 27 static MediaRouterDialogControllerAndroid* GetOrCreateForWebContents( |
| 30 content::WebContents* web_contents); | 28 content::WebContents* web_contents); |
| 31 | 29 |
| 32 // The methods called by the Java counterpart. | 30 // The methods called by the Java counterpart. |
| 33 | 31 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 // Use MediaRouterDialogControllerAndroid::CreateForWebContents() to create an | 43 // Use MediaRouterDialogControllerAndroid::CreateForWebContents() to create an |
| 46 // instance. | 44 // instance. |
| 47 explicit MediaRouterDialogControllerAndroid( | 45 explicit MediaRouterDialogControllerAndroid( |
| 48 content::WebContents* web_contents); | 46 content::WebContents* web_contents); |
| 49 | 47 |
| 50 // MediaRouterDialogController: | 48 // MediaRouterDialogController: |
| 51 void CreateMediaRouterDialog() override; | 49 void CreateMediaRouterDialog() override; |
| 52 void CloseMediaRouterDialog() override; | 50 void CloseMediaRouterDialog() override; |
| 53 bool IsShowingMediaRouterDialog() const override; | 51 bool IsShowingMediaRouterDialog() const override; |
| 54 | 52 |
| 55 // MediaRoutesObserver: | |
| 56 void OnRoutesUpdated(const std::vector<MediaRoute>& routes) override; | |
| 57 | |
| 58 void CancelPresentationRequest(); | 53 void CancelPresentationRequest(); |
| 59 | 54 |
| 60 base::android::ScopedJavaGlobalRef<jobject> java_dialog_controller_; | 55 base::android::ScopedJavaGlobalRef<jobject> java_dialog_controller_; |
| 61 | 56 |
| 62 // Null if no routes or more than one route exist. If there's only one route, | |
| 63 // keeps a copy to determine if the route controller dialog needs to be shown | |
| 64 // vs. the route chooser one. | |
| 65 scoped_ptr<MediaRoute> single_existing_route_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerAndroid); | 57 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerAndroid); |
| 68 }; | 58 }; |
| 69 | 59 |
| 70 } // namespace media_router | 60 } // namespace media_router |
| 71 | 61 |
| 72 #endif // CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_AN
DROID_H_ | 62 #endif // CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_AN
DROID_H_ |
| OLD | NEW |