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/ui/webui/media_router/media_router_dialog_controller.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 WebContents* MediaRouterDialogController::ShowMediaRouterDialog() { | 175 WebContents* MediaRouterDialogController::ShowMediaRouterDialog() { |
176 DCHECK(thread_checker_.CalledOnValidThread()); | 176 DCHECK(thread_checker_.CalledOnValidThread()); |
177 | 177 |
178 // Get the media router dialog for |initiator|, or create a new dialog | 178 // Get the media router dialog for |initiator|, or create a new dialog |
179 // if not found. | 179 // if not found. |
180 WebContents* media_router_dialog = GetMediaRouterDialog(); | 180 WebContents* media_router_dialog = GetMediaRouterDialog(); |
181 if (!media_router_dialog) | 181 if (!media_router_dialog) |
182 return CreateMediaRouterDialog(); | 182 return CreateMediaRouterDialog(); |
183 | 183 |
184 // Show the initiator holding the existing media router dialog. | 184 // Show the initiator holding the existing media router dialog. |
185 initiator_->GetDelegate()->ActivateContents(initiator_); | 185 // TODO(johnme): Can we sometimes be certain this was for a user gesture? |
| 186 initiator_->GetDelegate()->ActivateContents(initiator_, |
| 187 false /* user_gesture */); |
186 return media_router_dialog; | 188 return media_router_dialog; |
187 } | 189 } |
188 | 190 |
189 WebContents* MediaRouterDialogController::GetMediaRouterDialog() const { | 191 WebContents* MediaRouterDialogController::GetMediaRouterDialog() const { |
190 DCHECK(thread_checker_.CalledOnValidThread()); | 192 DCHECK(thread_checker_.CalledOnValidThread()); |
191 return dialog_observer_.get() ? dialog_observer_->web_contents() : nullptr; | 193 return dialog_observer_.get() ? dialog_observer_->web_contents() : nullptr; |
192 } | 194 } |
193 | 195 |
194 void MediaRouterDialogController::CloseMediaRouterDialog() { | 196 void MediaRouterDialogController::CloseMediaRouterDialog() { |
195 DCHECK(thread_checker_.CalledOnValidThread()); | 197 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 << "transition_type: " << transition_type << ", " | 274 << "transition_type: " << transition_type << ", " |
273 << "nav_type: " << nav_type; | 275 << "nav_type: " << nav_type; |
274 | 276 |
275 media_router_dialog_pending_ = false; | 277 media_router_dialog_pending_ = false; |
276 | 278 |
277 // TODO(imcheng): Initialize dialog. | 279 // TODO(imcheng): Initialize dialog. |
278 } | 280 } |
279 | 281 |
280 } // namespace media_router | 282 } // namespace media_router |
281 | 283 |
OLD | NEW |