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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDROID_H_
6 #define CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDROID_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h"
12 #include "chrome/browser/media/router/media_router_dialog_controller.h"
13 #include "content/public/browser/web_contents_user_data.h"
15 namespace media_router
{
17 // Android implementation of the MediaRouterDialogController.
18 class MediaRouterDialogControllerAndroid
19 : public content::WebContentsUserData
<MediaRouterDialogControllerAndroid
>,
20 public MediaRouterDialogController
{
22 ~MediaRouterDialogControllerAndroid() override
;
24 static bool Register(JNIEnv
* env
);
26 static MediaRouterDialogControllerAndroid
* GetOrCreateForWebContents(
27 content::WebContents
* web_contents
);
29 // The methods called by the Java counterpart.
31 // Notifies the controller that user has selected a sink with |jsink_id|.
32 void OnSinkSelected(JNIEnv
* env
, jobject obj
, jstring jsink_id
);
33 // Notifies the controller that the dialog has been dismissed and no device
35 void OnDialogDismissed(JNIEnv
* env
, jobject obj
);
38 friend class content::WebContentsUserData
<MediaRouterDialogControllerAndroid
>;
40 // Use MediaRouterDialogControllerAndroid::CreateForWebContents() to create an
42 explicit MediaRouterDialogControllerAndroid(
43 content::WebContents
* web_contents
);
45 // MediaRouterDialogController:
46 void CreateMediaRouterDialog() override
;
47 void CloseMediaRouterDialog() override
;
48 bool IsShowingMediaRouterDialog() const override
;
50 base::android::ScopedJavaGlobalRef
<jobject
> java_dialog_controller_
;
52 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerAndroid
);
55 } // namespace media_router
57 #endif // CHROME_BROWSER_MEDIA_ANDROID_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_ANDROID_H_