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

Side by Side Diff: chrome/browser/media/router/media_router_mojo_impl.cc

Issue 1202963004: Gets presentation ID from route ID upon route creation, and overrides previous presentation ID with… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/media/router/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/media_router_mojo_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // TODO(imcheng): We should handle failure in this case. One way is to invoke 42 // TODO(imcheng): We should handle failure in this case. One way is to invoke
43 // all pending requests with failure. (crbug.com/490787) 43 // all pending requests with failure. (crbug.com/490787)
44 void EventPageWakeComplete(bool success) { 44 void EventPageWakeComplete(bool success) {
45 if (!success) 45 if (!success)
46 LOG(ERROR) << "An error encountered while waking the event page."; 46 LOG(ERROR) << "An error encountered while waking the event page.";
47 } 47 }
48 48
49 scoped_ptr<content::PresentationSessionMessage> 49 scoped_ptr<content::PresentationSessionMessage>
50 ConvertToPresentationSessionMessage(interfaces::RouteMessagePtr input) { 50 ConvertToPresentationSessionMessage(interfaces::RouteMessagePtr input) {
51 DCHECK(!input.is_null()); 51 DCHECK(!input.is_null());
52 // TODO(haibinlu): get presentation_url&id from route_id 52 const auto& id_and_url = GetPresentationIdAndUrl(input->route_id);
53 std::string presentation_url; 53 const std::string& presentation_id = id_and_url.first;
54 std::string presentation_id; 54 const std::string& presentation_url = id_and_url.second;
55 scoped_ptr<content::PresentationSessionMessage> output; 55 scoped_ptr<content::PresentationSessionMessage> output;
56 switch (input->type) { 56 switch (input->type) {
57 case interfaces::RouteMessage::Type::TYPE_TEXT: { 57 case interfaces::RouteMessage::Type::TYPE_TEXT: {
58 DCHECK(!input->message.is_null()); 58 DCHECK(!input->message.is_null());
59 DCHECK(input->data.is_null()); 59 DCHECK(input->data.is_null());
60 output = content::PresentationSessionMessage::CreateStringMessage( 60 output = content::PresentationSessionMessage::CreateStringMessage(
61 presentation_url, presentation_id, make_scoped_ptr(new std::string)); 61 presentation_url, presentation_id, make_scoped_ptr(new std::string));
62 input->message.Swap(output->message.get()); 62 input->message.Swap(output->message.get());
63 return output.Pass(); 63 return output.Pass();
64 } 64 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return; 462 return;
463 } 463 }
464 464
465 for (const auto& next_request : pending_requests_) 465 for (const auto& next_request : pending_requests_)
466 next_request.Run(); 466 next_request.Run();
467 467
468 pending_requests_.clear(); 468 pending_requests_.clear();
469 } 469 }
470 470
471 } // namespace media_router 471 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/media/router/media_route_unittest.cc ('k') | chrome/browser/media/router/presentation_service_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698