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_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/media/router/create_session_request.h" | 9 #include "chrome/browser/media/router/create_presentation_session_request.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
11 #include "content/public/browser/web_contents_user_data.h" | 11 #include "content/public/browser/web_contents_user_data.h" |
12 | 12 |
13 namespace media_router { | 13 namespace media_router { |
14 | 14 |
15 // An instance of this class is tied to a WebContents known as the initiator, | 15 // An instance of this class is tied to a WebContents known as the initiator, |
16 // and is lazily created when a Media Router dialog needs to be shown. | 16 // and is lazily created when a Media Router dialog needs to be shown. |
17 // The MediaRouterDialogController allows creating, querying, and removing a | 17 // The MediaRouterDialogController allows creating, querying, and removing a |
18 // Media Router dialog modal to the initiator WebContents. | 18 // Media Router dialog modal to the initiator WebContents. |
19 // This class is not thread safe and must be called on the UI thread. | 19 // This class is not thread safe and must be called on the UI thread. |
(...skipping 13 matching lines...) Expand all Loading... |
33 // If the dialog already exists, brings the dialog to the front. | 33 // If the dialog already exists, brings the dialog to the front. |
34 // Returns WebContents for the media router dialog. | 34 // Returns WebContents for the media router dialog. |
35 content::WebContents* ShowMediaRouterDialog(); | 35 content::WebContents* ShowMediaRouterDialog(); |
36 | 36 |
37 // Creates a Media Router modal dialog using the initiator and parameters | 37 // Creates a Media Router modal dialog using the initiator and parameters |
38 // specified in |request|. If the dialog already exists, brings the dialog | 38 // specified in |request|. If the dialog already exists, brings the dialog |
39 // to the front, but does not change the dialog with |request|. | 39 // to the front, but does not change the dialog with |request|. |
40 // Returns WebContents for the media router dialog if a dialog was created. | 40 // Returns WebContents for the media router dialog if a dialog was created. |
41 // Otherwise returns nullptr and |request| is deleted. | 41 // Otherwise returns nullptr and |request| is deleted. |
42 content::WebContents* ShowMediaRouterDialogForPresentation( | 42 content::WebContents* ShowMediaRouterDialogForPresentation( |
43 scoped_ptr<CreateSessionRequest> request); | 43 scoped_ptr<CreatePresentationSessionRequest> request); |
44 | 44 |
45 // Returns the media router dialog WebContents. | 45 // Returns the media router dialog WebContents. |
46 // Returns nullptr if there is no dialog. | 46 // Returns nullptr if there is no dialog. |
47 content::WebContents* GetMediaRouterDialog() const; | 47 content::WebContents* GetMediaRouterDialog() const; |
48 | 48 |
49 // Closes the media router dialog. This will destroy the dialog WebContents. | 49 // Closes the media router dialog. This will destroy the dialog WebContents. |
50 // It is an error to call this function if there is currently no dialog. | 50 // It is an error to call this function if there is currently no dialog. |
51 void CloseMediaRouterDialog(); | 51 void CloseMediaRouterDialog(); |
52 | 52 |
53 private: | 53 private: |
(...skipping 21 matching lines...) Expand all Loading... |
75 | 75 |
76 content::WebContents* const initiator_; | 76 content::WebContents* const initiator_; |
77 | 77 |
78 // True if the controller is waiting for a new media router dialog to be | 78 // True if the controller is waiting for a new media router dialog to be |
79 // created. | 79 // created. |
80 bool media_router_dialog_pending_; | 80 bool media_router_dialog_pending_; |
81 | 81 |
82 // Data for dialogs created under a Presentation API context. | 82 // Data for dialogs created under a Presentation API context. |
83 // Passed from the caller of ShowMediaRouterDialogForPresentation(), and | 83 // Passed from the caller of ShowMediaRouterDialogForPresentation(), and |
84 // passed to the MediaRouterUI when it is initialized. | 84 // passed to the MediaRouterUI when it is initialized. |
85 scoped_ptr<CreateSessionRequest> presentation_request_; | 85 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; |
86 | 86 |
87 base::ThreadChecker thread_checker_; | 87 base::ThreadChecker thread_checker_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); | 89 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace media_router | 92 } // namespace media_router |
93 | 93 |
94 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H
_ | 94 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H
_ |
OLD | NEW |