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

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

Issue 2666873006: [Media Router] Convert to use typemaps for media_router.mojom. (Closed)
Patch Set: Remove DCHECK since tests are hitting the code path Created 3 years, 10 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 | « chrome/browser/ui/ash/cast_config_client_media_router.cc ('k') | chrome/test/BUILD.gn » ('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/ui/webui/media_router/media_router_webui_message_handle r.h" 5 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle r.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 std::unique_ptr<base::ListValue> sinks_val(new base::ListValue); 92 std::unique_ptr<base::ListValue> sinks_val(new base::ListValue);
93 93
94 for (const MediaSinkWithCastModes& sink_with_cast_modes : sinks) { 94 for (const MediaSinkWithCastModes& sink_with_cast_modes : sinks) {
95 std::unique_ptr<base::DictionaryValue> sink_val(new base::DictionaryValue); 95 std::unique_ptr<base::DictionaryValue> sink_val(new base::DictionaryValue);
96 96
97 const MediaSink& sink = sink_with_cast_modes.sink; 97 const MediaSink& sink = sink_with_cast_modes.sink;
98 sink_val->SetString("id", sink.id()); 98 sink_val->SetString("id", sink.id());
99 sink_val->SetString("name", sink.name()); 99 sink_val->SetString("name", sink.name());
100 sink_val->SetInteger("iconType", sink.icon_type()); 100 sink_val->SetInteger("iconType", sink.icon_type());
101 if (!sink.description().empty()) 101 if (sink.description())
102 sink_val->SetString("description", sink.description()); 102 sink_val->SetString("description", *sink.description());
103 103
104 bool is_pseudo_sink = 104 bool is_pseudo_sink =
105 base::StartsWith(sink.id(), "pseudo:", base::CompareCase::SENSITIVE); 105 base::StartsWith(sink.id(), "pseudo:", base::CompareCase::SENSITIVE);
106 if (!user_domain.empty() && !sink.domain().empty()) { 106 if (!user_domain.empty() && sink.domain() && !sink.domain()->empty()) {
107 std::string domain = sink.domain(); 107 std::string domain = *sink.domain();
108 // Convert default domains to user domain 108 // Convert default domains to user domain
109 if (sink.domain() == "default") { 109 if (domain == "default") {
110 domain = user_domain; 110 domain = user_domain;
111 if (domain == Profile::kNoHostedDomainFound) { 111 if (domain == Profile::kNoHostedDomainFound) {
112 // Default domain will be empty for non-dasher accounts. 112 // Default domain will be empty for non-dasher accounts.
113 domain.clear(); 113 domain.clear();
114 } 114 }
115 } 115 }
116 116
117 sink_val->SetString("domain", domain); 117 sink_val->SetString("domain", domain);
118 118
119 show_email = show_email || !is_pseudo_sink; 119 show_email = show_email || !is_pseudo_sink;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 896 }
897 897
898 return value; 898 return value;
899 } 899 }
900 900
901 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { 901 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) {
902 set_web_ui(web_ui); 902 set_web_ui(web_ui);
903 } 903 }
904 904
905 } // namespace media_router 905 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/cast_config_client_media_router.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698