Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_ui.cc

Issue 2108973002: [Media Router] Return NotFoundError on dialog exit if appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ui.h" 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 MediaRouterUI::~MediaRouterUI() { 198 MediaRouterUI::~MediaRouterUI() {
199 if (issues_observer_) issues_observer_->UnregisterObserver(); 199 if (issues_observer_) issues_observer_->UnregisterObserver();
200 200
201 if (query_result_manager_.get()) query_result_manager_->RemoveObserver(this); 201 if (query_result_manager_.get()) query_result_manager_->RemoveObserver(this);
202 if (presentation_service_delegate_.get()) 202 if (presentation_service_delegate_.get())
203 presentation_service_delegate_->RemoveDefaultPresentationRequestObserver( 203 presentation_service_delegate_->RemoveDefaultPresentationRequestObserver(
204 this); 204 this);
205 // If |create_session_request_| still exists, then it means presentation route 205 // If |create_session_request_| still exists, then it means presentation route
206 // request was never attempted. 206 // request was never attempted. This could be because the dialog defaults to
imcheng 2016/06/29 17:28:03 nit: I would just leave out the part about default
btolsch 2016/06/30 07:29:16 Done.
207 // mirroring when no devices support the presentation url.
207 if (create_session_request_) { 208 if (create_session_request_) {
208 create_session_request_->InvokeErrorCallback(content::PresentationError( 209 bool presentation_sinks_available = std::any_of(
209 content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, 210 sinks_.begin(), sinks_.end(), [](const MediaSinkWithCastModes& sink) {
210 "Dialog closed.")); 211 return sink.cast_modes.find(MediaCastMode::DEFAULT) !=
imcheng 2016/06/29 17:28:03 nit: return sink.cast_modes.ContainsValue(MediaCas
btolsch 2016/06/30 07:29:16 Done.
imcheng 2016/06/30 18:24:46 Thanks. Apologies for suggesting the wrong syntax
212 sink.cast_modes.end();
213 });
214 if (presentation_sinks_available) {
215 create_session_request_->InvokeErrorCallback(content::PresentationError(
216 content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED,
217 "Dialog closed."));
218 } else {
219 create_session_request_->InvokeErrorCallback(content::PresentationError(
220 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS,
221 "No screens found."));
222 }
211 } 223 }
212 } 224 }
213 225
214 void MediaRouterUI::InitWithDefaultMediaSource( 226 void MediaRouterUI::InitWithDefaultMediaSource(
215 const base::WeakPtr<PresentationServiceDelegateImpl>& delegate) { 227 const base::WeakPtr<PresentationServiceDelegateImpl>& delegate) {
216 DCHECK(delegate); 228 DCHECK(delegate);
217 DCHECK(!presentation_service_delegate_); 229 DCHECK(!presentation_service_delegate_);
218 DCHECK(!query_result_manager_.get()); 230 DCHECK(!query_result_manager_.get());
219 231
220 presentation_service_delegate_ = delegate; 232 presentation_service_delegate_ = delegate;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 base::Time::Now() - start_time_); 696 base::Time::Now() - start_time_);
685 start_time_ = base::Time(); 697 start_time_ = base::Time();
686 } 698 }
687 } 699 }
688 700
689 void MediaRouterUI::UpdateMaxDialogHeight(int height) { 701 void MediaRouterUI::UpdateMaxDialogHeight(int height) {
690 handler_->UpdateMaxDialogHeight(height); 702 handler_->UpdateMaxDialogHeight(height);
691 } 703 }
692 704
693 } // namespace media_router 705 } // namespace media_router
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698