| 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_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 explicit MediaRouterDialogController(content::WebContents* initiator); | 60 explicit MediaRouterDialogController(content::WebContents* initiator); |
| 61 | 61 |
| 62 // Activates the WebContents that initiated the dialog, e.g. focuses the tab. | 62 // Activates the WebContents that initiated the dialog, e.g. focuses the tab. |
| 63 void ActivateInitiatorWebContents(); | 63 void ActivateInitiatorWebContents(); |
| 64 | 64 |
| 65 // Passes the ownership of the CreatePresentationSessionRequest to the caller. | 65 // Passes the ownership of the CreatePresentationSessionRequest to the caller. |
| 66 scoped_ptr<CreatePresentationSessionRequest> TakePresentationRequest(); | 66 scoped_ptr<CreatePresentationSessionRequest> TakePresentationRequest(); |
| 67 | 67 |
| 68 // Returns the CreatePresentationSessionRequest to the caller but keeps the | 68 // Returns the CreatePresentationSessionRequest to the caller but keeps the |
| 69 // ownership with the MediaRouterDialogController. | 69 // ownership with the MediaRouterDialogController. |
| 70 const CreatePresentationSessionRequest* presentation_request() const { | 70 const CreatePresentationSessionRequest* create_session_request() const { |
| 71 return presentation_request_.get(); | 71 return create_session_request_.get(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Returns the WebContents that initiated showing the dialog. | 74 // Returns the WebContents that initiated showing the dialog. |
| 75 content::WebContents* initiator() const { return initiator_; } | 75 content::WebContents* initiator() const { return initiator_; } |
| 76 | 76 |
| 77 // Resets the state of the controller. Must be called from the overrides. | 77 // Resets the state of the controller. Must be called from the overrides. |
| 78 virtual void Reset(); | 78 virtual void Reset(); |
| 79 // Creates a new media router dialog modal to |initiator_|. | 79 // Creates a new media router dialog modal to |initiator_|. |
| 80 virtual void CreateMediaRouterDialog() = 0; | 80 virtual void CreateMediaRouterDialog() = 0; |
| 81 // Closes the media router dialog if it exists. | 81 // Closes the media router dialog if it exists. |
| 82 virtual void CloseMediaRouterDialog() = 0; | 82 virtual void CloseMediaRouterDialog() = 0; |
| 83 | 83 |
| 84 base::ThreadChecker thread_checker_; | 84 base::ThreadChecker thread_checker_; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 class InitiatorWebContentsObserver; | 87 class InitiatorWebContentsObserver; |
| 88 | 88 |
| 89 // An observer for the |initiator_| that closes the dialog when |initiator_| | 89 // An observer for the |initiator_| that closes the dialog when |initiator_| |
| 90 // is destroyed or navigated. | 90 // is destroyed or navigated. |
| 91 scoped_ptr<InitiatorWebContentsObserver> initiator_observer_; | 91 scoped_ptr<InitiatorWebContentsObserver> initiator_observer_; |
| 92 content::WebContents* const initiator_; | 92 content::WebContents* const initiator_; |
| 93 | 93 |
| 94 // Data for dialogs created at the request of the Presentation API. | 94 // Data for dialogs created at the request of the Presentation API. |
| 95 // Passed from the caller via ShowMediaRouterDialogForPresentation to the | 95 // Passed from the caller via ShowMediaRouterDialogForPresentation to the |
| 96 // dialog when it is initialized. | 96 // dialog when it is initialized. |
| 97 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; | 97 scoped_ptr<CreatePresentationSessionRequest> create_session_request_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); | 99 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace media_router | 102 } // namespace media_router |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 104 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
| OLD | NEW |