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