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

Unified Diff: chrome/browser/media/router/create_presentation_session_request.cc

Issue 1406013003: [Presentation API / Media Router] Clean up default pres URL logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Original patch Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/create_presentation_session_request.cc
diff --git a/chrome/browser/media/router/create_presentation_session_request.cc b/chrome/browser/media/router/create_presentation_session_request.cc
deleted file mode 100644
index b3b4bc851e45d1547f98bdfce75553cb1bd10fdd..0000000000000000000000000000000000000000
--- a/chrome/browser/media/router/create_presentation_session_request.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/media/router/create_presentation_session_request.h"
-
-#include "chrome/browser/media/router/media_source_helper.h"
-
-using content::PresentationSessionInfo;
-using content::PresentationError;
-
-namespace media_router {
-
-CreatePresentationSessionRequest::CreatePresentationSessionRequest(
- const std::string& presentation_url,
- const GURL& frame_url,
- const PresentationSessionSuccessCallback& success_cb,
- const PresentationSessionErrorCallback& error_cb)
- : media_source_(MediaSourceForPresentationUrl(presentation_url)),
- frame_url_(frame_url),
- success_cb_(success_cb),
- error_cb_(error_cb),
- cb_invoked_(false) {
- DCHECK(!success_cb.is_null());
- DCHECK(!error_cb.is_null());
-}
-
-CreatePresentationSessionRequest::~CreatePresentationSessionRequest() {
- if (!cb_invoked_) {
- error_cb_.Run(content::PresentationError(
- content::PRESENTATION_ERROR_UNKNOWN, "Unknown error."));
- }
-}
-
-void CreatePresentationSessionRequest::InvokeSuccessCallback(
- const std::string& presentation_id,
- const MediaRoute::Id& route_id) {
- DCHECK(!cb_invoked_);
- if (!cb_invoked_) {
- // Overwrite presentation ID.
- success_cb_.Run(
- content::PresentationSessionInfo(
- PresentationUrlFromMediaSource(media_source_), presentation_id),
- route_id);
- cb_invoked_ = true;
- }
-}
-
-void CreatePresentationSessionRequest::InvokeErrorCallback(
- const content::PresentationError& error) {
- DCHECK(!cb_invoked_);
- if (!cb_invoked_) {
- error_cb_.Run(error);
- cb_invoked_ = true;
- }
-}
-
-// static
-void CreatePresentationSessionRequest::HandleRouteResponse(
- scoped_ptr<CreatePresentationSessionRequest> presentation_request,
- const MediaRoute* route,
- const std::string& presentation_id,
- const std::string& error) {
- if (!route) {
- presentation_request->InvokeErrorCallback(
- content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, error));
- } else {
- presentation_request->InvokeSuccessCallback(presentation_id,
- route->media_route_id());
- }
-}
-
-} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698