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 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 5 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
6 | 6 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 bool MediaRouterDialogController::ShowMediaRouterDialogForPresentation( | 74 bool MediaRouterDialogController::ShowMediaRouterDialogForPresentation( |
75 scoped_ptr<CreatePresentationSessionRequest> request) { | 75 scoped_ptr<CreatePresentationSessionRequest> request) { |
76 DCHECK(thread_checker_.CalledOnValidThread()); | 76 DCHECK(thread_checker_.CalledOnValidThread()); |
77 | 77 |
78 // Check if the media router dialog exists for |initiator| and return if so. | 78 // Check if the media router dialog exists for |initiator| and return if so. |
79 if (IsShowingMediaRouterDialog()) | 79 if (IsShowingMediaRouterDialog()) |
80 return false; | 80 return false; |
81 | 81 |
82 presentation_request_ = request.Pass(); | 82 create_session_request_ = request.Pass(); |
83 CreateMediaRouterDialog(); | 83 CreateMediaRouterDialog(); |
84 | 84 |
85 // Show the initiator holding the existing media router dialog. | 85 // Show the initiator holding the existing media router dialog. |
86 ActivateInitiatorWebContents(); | 86 ActivateInitiatorWebContents(); |
87 | 87 |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 bool MediaRouterDialogController::ShowMediaRouterDialog() { | 91 bool MediaRouterDialogController::ShowMediaRouterDialog() { |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 92 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 12 matching lines...) Expand all Loading... |
105 CloseMediaRouterDialog(); | 105 CloseMediaRouterDialog(); |
106 Reset(); | 106 Reset(); |
107 } | 107 } |
108 | 108 |
109 void MediaRouterDialogController::ActivateInitiatorWebContents() { | 109 void MediaRouterDialogController::ActivateInitiatorWebContents() { |
110 initiator_->GetDelegate()->ActivateContents(initiator_); | 110 initiator_->GetDelegate()->ActivateContents(initiator_); |
111 } | 111 } |
112 | 112 |
113 scoped_ptr<CreatePresentationSessionRequest> | 113 scoped_ptr<CreatePresentationSessionRequest> |
114 MediaRouterDialogController::TakePresentationRequest() { | 114 MediaRouterDialogController::TakePresentationRequest() { |
115 return presentation_request_.Pass(); | 115 return create_session_request_.Pass(); |
116 } | 116 } |
117 | 117 |
118 void MediaRouterDialogController::Reset() { | 118 void MediaRouterDialogController::Reset() { |
119 initiator_observer_.reset(); | 119 initiator_observer_.reset(); |
120 presentation_request_.reset(); | 120 create_session_request_.reset(); |
121 } | 121 } |
122 | 122 |
123 } // namespace media_router | 123 } // namespace media_router |
OLD | NEW |