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