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

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

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
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_source_helper.h" 5 #include "chrome/browser/media/router/media_source_helper.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/media/router/media_source.h" 9 #include "chrome/browser/media/router/media_source.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 16 matching lines...) Expand all
27 27
28 MediaSource MediaSourceForCastApp(const std::string& app_id) { 28 MediaSource MediaSourceForCastApp(const std::string& app_id) {
29 return MediaSource(kCastUrnPrefix + app_id); 29 return MediaSource(kCastUrnPrefix + app_id);
30 } 30 }
31 31
32 MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url) { 32 MediaSource MediaSourceForPresentationUrl(const std::string& presentation_url) {
33 return MediaSource(presentation_url); 33 return MediaSource(presentation_url);
34 } 34 }
35 35
36 bool IsMirroringMediaSource(const MediaSource& source) { 36 bool IsMirroringMediaSource(const MediaSource& source) {
37 return base::StartsWithASCII(source.id(), kDesktopMediaUrn, true) || 37 return base::StartsWith(source.id(), kDesktopMediaUrn,
38 base::StartsWithASCII(source.id(), kTabMediaUrnPrefix, true); 38 base::CompareCase::SENSITIVE) ||
39 base::StartsWith(source.id(), kTabMediaUrnPrefix,
40 base::CompareCase::SENSITIVE);
39 } 41 }
40 42
41 bool IsValidMediaSource(const MediaSource& source) { 43 bool IsValidMediaSource(const MediaSource& source) {
42 if (IsMirroringMediaSource(source) || 44 if (IsMirroringMediaSource(source) ||
43 base::StartsWithASCII(source.id(), kCastUrnPrefix, true)) { 45 base::StartsWith(source.id(), kCastUrnPrefix,
46 base::CompareCase::SENSITIVE)) {
44 return true; 47 return true;
45 } 48 }
46 GURL url(source.id()); 49 GURL url(source.id());
47 return url.is_valid() && url.SchemeIsHTTPOrHTTPS(); 50 return url.is_valid() && url.SchemeIsHTTPOrHTTPS();
48 } 51 }
49 52
50 std::string PresentationUrlFromMediaSource(const MediaSource& source) { 53 std::string PresentationUrlFromMediaSource(const MediaSource& source) {
51 return IsValidPresentationUrl(source.id()) ? source.id() : ""; 54 return IsValidPresentationUrl(source.id()) ? source.id() : "";
52 } 55 }
53 56
54 bool IsValidPresentationUrl(const std::string& url) { 57 bool IsValidPresentationUrl(const std::string& url) {
55 GURL gurl(url); 58 GURL gurl(url);
56 return gurl.is_valid() && gurl.SchemeIsHTTPOrHTTPS(); 59 return gurl.is_valid() && gurl.SchemeIsHTTPOrHTTPS();
57 } 60 }
58 61
59 } // namespace media_router 62 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698