| 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 "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
| 10 | 11 |
| 11 #if defined(OS_ANDROID) | 12 #if defined(OS_ANDROID) |
| 12 #include "chrome/browser/media/android/router/media_router_dialog_controller_and
roid.h" | 13 #include "chrome/browser/media/android/router/media_router_dialog_controller_and
roid.h" |
| 13 #else | 14 #else |
| 14 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im
pl.h" | 15 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im
pl.h" |
| 15 #endif | 16 #endif |
| 16 | 17 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // 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. |
| 79 if (IsShowingMediaRouterDialog()) | 80 if (IsShowingMediaRouterDialog()) |
| 80 return false; | 81 return false; |
| 81 | 82 |
| 82 presentation_request_ = request.Pass(); | 83 presentation_request_ = request.Pass(); |
| 83 CreateMediaRouterDialog(); | 84 CreateMediaRouterDialog(); |
| 84 | 85 |
| 85 // Show the initiator holding the existing media router dialog. | 86 // Show the initiator holding the existing media router dialog. |
| 86 ActivateInitiatorWebContents(); | 87 ActivateInitiatorWebContents(); |
| 87 | 88 |
| 89 media_router::MediaRouterMetrics::RecordMediaRouterDialogOrigin( |
| 90 media_router::PAGE); |
| 91 |
| 88 return true; | 92 return true; |
| 89 } | 93 } |
| 90 | 94 |
| 91 bool MediaRouterDialogController::ShowMediaRouterDialog() { | 95 bool MediaRouterDialogController::ShowMediaRouterDialog() { |
| 92 DCHECK(thread_checker_.CalledOnValidThread()); | 96 DCHECK(thread_checker_.CalledOnValidThread()); |
| 93 | 97 |
| 94 // Don't create dialog if it already exists. | 98 // Don't create dialog if it already exists. |
| 95 bool dialog_needs_creation = !IsShowingMediaRouterDialog(); | 99 bool dialog_needs_creation = !IsShowingMediaRouterDialog(); |
| 96 if (dialog_needs_creation) | 100 if (dialog_needs_creation) |
| 97 CreateMediaRouterDialog(); | 101 CreateMediaRouterDialog(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 114 MediaRouterDialogController::TakePresentationRequest() { | 118 MediaRouterDialogController::TakePresentationRequest() { |
| 115 return presentation_request_.Pass(); | 119 return presentation_request_.Pass(); |
| 116 } | 120 } |
| 117 | 121 |
| 118 void MediaRouterDialogController::Reset() { | 122 void MediaRouterDialogController::Reset() { |
| 119 initiator_observer_.reset(); | 123 initiator_observer_.reset(); |
| 120 presentation_request_.reset(); | 124 presentation_request_.reset(); |
| 121 } | 125 } |
| 122 | 126 |
| 123 } // namespace media_router | 127 } // namespace media_router |
| OLD | NEW |