| 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..86e3620a5bc970d644939d8ce675d792e2847af8 100644
 | 
| --- a/chrome/browser/media/router/media_router_dialog_controller.h
 | 
| +++ b/chrome/browser/media/router/media_router_dialog_controller.h
 | 
| @@ -6,7 +6,10 @@
 | 
|  #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_
 | 
|  
 | 
|  #include "base/macros.h"
 | 
| +#include "base/memory/scoped_ptr.h"
 | 
| +#include "base/threading/thread_checker.h"
 | 
|  #include "chrome/browser/media/router/create_presentation_session_request.h"
 | 
| +#include "content/public/browser/web_contents_observer.h"
 | 
|  
 | 
|  namespace content {
 | 
|  class WebContents;
 | 
| @@ -14,14 +17,14 @@ class WebContents;
 | 
|  
 | 
|  namespace media_router {
 | 
|  
 | 
| -// An implementation of this interface is tied to a WebContents known as the
 | 
| -// initiator, and is lazily created when a Media Router dialog needs to be
 | 
| -// shown. The MediaRouterDialogController allows creating, querying, and
 | 
| -// removing a Media Router dialog modal to the initiator WebContents.
 | 
| +// An abstract base class for Media Router dialog controllers. Tied to a
 | 
| +// WebContents known as the |initiator|, and is lazily created when a Media
 | 
| +// Router dialog needs to be shown. The MediaRouterDialogController allows
 | 
| +// showing and closing a Media Router dialog modal to the initiator WebContents.
 | 
|  // 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
 | 
| @@ -29,13 +32,59 @@ class MediaRouterDialogController {
 | 
|    static MediaRouterDialogController* GetOrCreateForWebContents(
 | 
|        content::WebContents* web_contents);
 | 
|  
 | 
| -  // Creates a Media Router modal dialog using the initiator and parameters
 | 
| -  // specified in |request|. If the dialog already exists, brings the dialog
 | 
| -  // to the front, but does not change the dialog with |request|.
 | 
| -  // Returns WebContents for the media router dialog if a dialog was created.
 | 
| -  // Otherwise returns false and |request| is deleted.
 | 
| -  virtual bool ShowMediaRouterDialogForPresentation(
 | 
| -      scoped_ptr<CreatePresentationSessionRequest> request) = 0;
 | 
| +  // Shows the media router dialog modal to |initiator_| and the parameters
 | 
| +  // specified in |request|.
 | 
| +  // Creates the dialog if it did not exist prior to this call, returns true.
 | 
| +  // If the dialog already exists, brings it to the front but doesn't change the
 | 
| +  // dialog with |request|, returns false and |request| is deleted.
 | 
| +  bool ShowMediaRouterDialogForPresentation(
 | 
| +      scoped_ptr<CreatePresentationSessionRequest> request);
 | 
| +
 | 
| +  // Shows the media router dialog modal to |initiator_|.
 | 
| +  // Creates the dialog if it did not exist prior to this call, returns true.
 | 
| +  // If the dialog already exists, brings it to the front, returns false.
 | 
| +  virtual bool ShowMediaRouterDialog();
 | 
| +
 | 
| +  // Hides the media router dialog.
 | 
| +  // It is a no-op to call this function if there is currently no dialog.
 | 
| +  void HideMediaRouterDialog();
 | 
| +
 | 
| + protected:
 | 
| +  // Use MediaRouterDialogController::GetOrCreateForWebContents() to create an
 | 
| +  // instance.
 | 
| +  explicit MediaRouterDialogController(content::WebContents* initiator);
 | 
| +
 | 
| +  void ActivateInitiatorWebContents();
 | 
| +
 | 
| +  scoped_ptr<CreatePresentationSessionRequest> PassPresentationRequest();
 | 
| +
 | 
| +  content::WebContents* initiator() const { return initiator_; }
 | 
| +
 | 
| +  // Resets the state of the controller. Must be called from the overrides.
 | 
| +  virtual void Reset();
 | 
| +  // Creates a new media router dialog modal to |initiator_|.
 | 
| +  virtual void CreateMediaRouterDialog() = 0;
 | 
| +  // Closes the media router dialog if it exists.
 | 
| +  virtual void CloseMediaRouterDialog() = 0;
 | 
| +  // Indicates if the media router dialog already exists.
 | 
| +  virtual bool IsShowingMediaRouterDialog() const = 0;
 | 
| +
 | 
| +  base::ThreadChecker thread_checker_;
 | 
| +
 | 
| + private:
 | 
| +  class InitiatorWebContentsObserver;
 | 
| +
 | 
| +  // An observer for the |initiator_| that closes the dialog when |initiator_|
 | 
| +  // is destroyed or navigated.
 | 
| +  scoped_ptr<InitiatorWebContentsObserver> initiator_observer_;
 | 
| +  content::WebContents* const initiator_;
 | 
| +
 | 
| +  // Data for dialogs created at the request of the Presentation API.
 | 
| +  // Passed from the caller via ShowMediaRouterDialogForPresentation to the
 | 
| +  // dialog when it is initialized.
 | 
| +  scoped_ptr<CreatePresentationSessionRequest> presentation_request_;
 | 
| +
 | 
| +  DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController);
 | 
|  };
 | 
|  
 | 
|  }  // namespace media_router
 | 
| 
 |