| 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> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 11 #include "chrome/browser/media/router/create_presentation_session_request.h" | 13 #include "chrome/browser/media/router/create_presentation_session_request.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 class WebContents; | 17 class WebContents; |
| 16 } // namespace content | 18 } // namespace content |
| 17 | 19 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 47 | 49 |
| 48 // Hides the media router dialog. | 50 // Hides the media router dialog. |
| 49 // It is a no-op to call this function if there is currently no dialog. | 51 // It is a no-op to call this function if there is currently no dialog. |
| 50 void HideMediaRouterDialog(); | 52 void HideMediaRouterDialog(); |
| 51 | 53 |
| 52 protected: | 54 protected: |
| 53 // Use MediaRouterDialogController::GetOrCreateForWebContents() to create an | 55 // Use MediaRouterDialogController::GetOrCreateForWebContents() to create an |
| 54 // instance. | 56 // instance. |
| 55 explicit MediaRouterDialogController(content::WebContents* initiator); | 57 explicit MediaRouterDialogController(content::WebContents* initiator); |
| 56 | 58 |
| 59 // Activates the WebContents that initiated the dialog, e.g. focuses the tab. |
| 57 void ActivateInitiatorWebContents(); | 60 void ActivateInitiatorWebContents(); |
| 58 | 61 |
| 59 scoped_ptr<CreatePresentationSessionRequest> PassPresentationRequest(); | 62 // Passes the ownership of the CreatePresentationSessionRequest to the caller. |
| 63 scoped_ptr<CreatePresentationSessionRequest> TakePresentationRequest(); |
| 60 | 64 |
| 65 // Returns the CreatePresentationSessionRequest to the caller but keeps the |
| 66 // ownership with the MediaRouterDialogController. |
| 67 const CreatePresentationSessionRequest* presentation_request() const { |
| 68 return presentation_request_.get(); |
| 69 } |
| 70 |
| 71 // Returns the WebContents that initiated showing the dialog. |
| 61 content::WebContents* initiator() const { return initiator_; } | 72 content::WebContents* initiator() const { return initiator_; } |
| 62 | 73 |
| 63 // Resets the state of the controller. Must be called from the overrides. | 74 // Resets the state of the controller. Must be called from the overrides. |
| 64 virtual void Reset(); | 75 virtual void Reset(); |
| 65 // Creates a new media router dialog modal to |initiator_|. | 76 // Creates a new media router dialog modal to |initiator_|. |
| 66 virtual void CreateMediaRouterDialog() = 0; | 77 virtual void CreateMediaRouterDialog() = 0; |
| 67 // Closes the media router dialog if it exists. | 78 // Closes the media router dialog if it exists. |
| 68 virtual void CloseMediaRouterDialog() = 0; | 79 virtual void CloseMediaRouterDialog() = 0; |
| 69 // Indicates if the media router dialog already exists. | 80 // Indicates if the media router dialog already exists. |
| 70 virtual bool IsShowingMediaRouterDialog() const = 0; | 81 virtual bool IsShowingMediaRouterDialog() const = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 // Passed from the caller via ShowMediaRouterDialogForPresentation to the | 94 // Passed from the caller via ShowMediaRouterDialogForPresentation to the |
| 84 // dialog when it is initialized. | 95 // dialog when it is initialized. |
| 85 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; | 96 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; |
| 86 | 97 |
| 87 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); | 98 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); |
| 88 }; | 99 }; |
| 89 | 100 |
| 90 } // namespace media_router | 101 } // namespace media_router |
| 91 | 102 |
| 92 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 103 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
| OLD | NEW |