Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: chrome/browser/media/router/media_router_dialog_controller.h

Issue 1243173003: [MediaRouter] Moved the code useful for Android to MediaRouterDialogController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@build-media-router-android
Patch Set: Moved base CloseMediaRouterDialog to the end of the derived implementation method Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/media_router_dialog_controller.h
diff --git a/chrome/browser/media/router/media_router_dialog_controller.h b/chrome/browser/media/router/media_router_dialog_controller.h
index a627b44d91d7c8baa5f41ebc178a359ce57d3acc..a2891e8ce7cacf0785c18a27eb4d6f6467e0f1da 100644
--- a/chrome/browser/media/router/media_router_dialog_controller.h
+++ b/chrome/browser/media/router/media_router_dialog_controller.h
@@ -6,7 +6,9 @@
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/media/router/create_presentation_session_request.h"
+#include "content/public/browser/web_contents_observer.h"
namespace content {
class WebContents;
@@ -21,7 +23,7 @@ namespace media_router {
// This class is not thread safe and must be called on the UI thread.
class MediaRouterDialogController {
public:
- virtual ~MediaRouterDialogController() = default;
+ virtual ~MediaRouterDialogController();
// Gets a reference to the MediaRouterDialogController associated with
// |web_contents|, creating one if it does not exist. The returned pointer is
@@ -36,6 +38,36 @@ class MediaRouterDialogController {
// Otherwise returns false and |request| is deleted.
virtual bool ShowMediaRouterDialogForPresentation(
scoped_ptr<CreatePresentationSessionRequest> request) = 0;
+
+ // Closes the media router dialog.
+ // It is an error to call this function if there is currently no dialog.
+ virtual void CloseMediaRouterDialog() = 0;
+
+protected:
imcheng 2015/07/23 00:41:14 nit:indent
whywhat 2015/07/23 21:20:09 Done.
+ // Use MediaRouterDialogController::GetOrCreateForWebContents() to create an
+ // instance.
+ explicit MediaRouterDialogController(content::WebContents* initiator);
+
+ void ActivateInitiatorWebContents();
+ void CreateMediaRouterDialog();
+ scoped_ptr<CreatePresentationSessionRequest> PassPresentationRequest();
+ void SetPresentationRequest(
+ scoped_ptr<CreatePresentationSessionRequest> request);
+
+ content::WebContents* initiator() { return initiator_; }
+
+ virtual void Reset() = 0;
imcheng 2015/07/23 00:41:14 this needs documentation.
whywhat 2015/07/23 21:20:09 Done.
+
+private:
imcheng 2015/07/23 00:41:14 nit: indent
whywhat 2015/07/23 21:20:09 Done.
+ class InitiatorWebContentsObserver;
+
+ scoped_ptr<InitiatorWebContentsObserver> initiator_observer_;
+ content::WebContents* const initiator_;
+
+ // Data for dialogs created under a Presentation API context.
+ // Passed from the caller of ShowMediaRouterDialogForPresentation(), and
+ // passed to the dialog when it is initialized.
+ scoped_ptr<CreatePresentationSessionRequest> presentation_request_;
};
imcheng 2015/07/23 00:41:14 DISALLOW_COPY_AND_ASSIGN ?
whywhat 2015/07/23 21:20:09 Done.
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698