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

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

Issue 2574673002: Removes ScopedVector from presentation_service_impl. (Closed)
Patch Set: Fixes test. Created 4 years 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 | content/browser/presentation/presentation_service_impl.h » ('j') | 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/media/router/presentation_service_delegate_impl.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const MediaRoute::Id& route_id, 85 const MediaRoute::Id& route_id,
86 const content::PresentationConnectionMessageCallback& message_cb) 86 const content::PresentationConnectionMessageCallback& message_cb)
87 : RouteMessageObserver(router, route_id), message_cb_(message_cb) { 87 : RouteMessageObserver(router, route_id), message_cb_(message_cb) {
88 DCHECK(!message_cb_.is_null()); 88 DCHECK(!message_cb_.is_null());
89 } 89 }
90 90
91 ~PresentationSessionMessagesObserver() final {} 91 ~PresentationSessionMessagesObserver() final {}
92 92
93 void OnMessagesReceived(const std::vector<RouteMessage>& messages) final { 93 void OnMessagesReceived(const std::vector<RouteMessage>& messages) final {
94 DVLOG(2) << __func__ << ", number of messages : " << messages.size(); 94 DVLOG(2) << __func__ << ", number of messages : " << messages.size();
95 ScopedVector<content::PresentationConnectionMessage> presentation_messages; 95 std::vector<std::unique_ptr<content::PresentationConnectionMessage>>
96 presentation_messages;
96 for (const RouteMessage& message : messages) { 97 for (const RouteMessage& message : messages) {
97 if (message.type == RouteMessage::TEXT && message.text) { 98 if (message.type == RouteMessage::TEXT && message.text) {
98 presentation_messages.push_back( 99 presentation_messages.push_back(
99 new content::PresentationConnectionMessage( 100 base::MakeUnique<content::PresentationConnectionMessage>(
100 content::PresentationMessageType::TEXT)); 101 content::PresentationMessageType::TEXT));
101 presentation_messages.back()->message = *message.text; 102 presentation_messages.back()->message = *message.text;
102 } else if (message.type == RouteMessage::BINARY && message.binary) { 103 } else if (message.type == RouteMessage::BINARY && message.binary) {
103 presentation_messages.push_back( 104 presentation_messages.push_back(
104 new content::PresentationConnectionMessage( 105 base::MakeUnique<content::PresentationConnectionMessage>(
105 content::PresentationMessageType::BINARY)); 106 content::PresentationMessageType::BINARY));
106 presentation_messages.back()->data.reset( 107 presentation_messages.back()->data.reset(
107 new std::vector<uint8_t>(*message.binary)); 108 new std::vector<uint8_t>(*message.binary));
108 } 109 }
109 } 110 }
110 // TODO(miu): Remove second argument from PresentationSessionMessageCallback 111 // TODO(miu): Remove second argument from PresentationSessionMessageCallback
111 // since it's always true now. 112 // since it's always true now.
112 message_cb_.Run(presentation_messages, true); 113 message_cb_.Run(presentation_messages, true);
113 } 114 }
114 115
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 const base::ListValue* origins = 1003 const base::ListValue* origins =
1003 Profile::FromBrowserContext(web_contents_->GetBrowserContext()) 1004 Profile::FromBrowserContext(web_contents_->GetBrowserContext())
1004 ->GetPrefs() 1005 ->GetPrefs()
1005 ->GetList(prefs::kMediaRouterTabMirroringSources); 1006 ->GetList(prefs::kMediaRouterTabMirroringSources);
1006 return origins && 1007 return origins &&
1007 origins->Find(base::StringValue(origin.Serialize())) != origins->end(); 1008 origins->Find(base::StringValue(origin.Serialize())) != origins->end();
1008 } 1009 }
1009 #endif // !defined(OS_ANDROID) 1010 #endif // !defined(OS_ANDROID)
1010 1011
1011 } // namespace media_router 1012 } // namespace media_router
OLDNEW
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698