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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/installer/util/shell_util.cc ('k') | chrome/renderer/content_settings_observer.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // Temporarily allow these whitelisted apps and WebUIs to use NaCl. 1012 // Temporarily allow these whitelisted apps and WebUIs to use NaCl.
1013 std::string app_url_host = app_url.host(); 1013 std::string app_url_host = app_url.host();
1014 std::string manifest_url_path = manifest_url.path(); 1014 std::string manifest_url_path = manifest_url.path();
1015 1015
1016 bool is_whitelisted_web_ui = 1016 bool is_whitelisted_web_ui =
1017 app_url.spec() == chrome::kChromeUIAppListStartPageURL; 1017 app_url.spec() == chrome::kChromeUIAppListStartPageURL;
1018 1018
1019 bool is_photo_app = 1019 bool is_photo_app =
1020 // Whitelisted apps must be served over https. 1020 // Whitelisted apps must be served over https.
1021 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() && 1021 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() &&
1022 (EndsWith(app_url_host, "plus.google.com", false) || 1022 (base::EndsWith(app_url_host, "plus.google.com", false) ||
1023 EndsWith(app_url_host, "plus.sandbox.google.com", false)) && 1023 base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) &&
1024 manifest_url.DomainIs("ssl.gstatic.com") && 1024 manifest_url.DomainIs("ssl.gstatic.com") &&
1025 (manifest_url_path.find("s2/oz/nacl/") == 1 || 1025 (manifest_url_path.find("s2/oz/nacl/") == 1 ||
1026 manifest_url_path.find("photos/nacl/") == 1); 1026 manifest_url_path.find("photos/nacl/") == 1);
1027 1027
1028 std::string manifest_fs_host; 1028 std::string manifest_fs_host;
1029 if (manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()) { 1029 if (manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()) {
1030 manifest_fs_host = manifest_url.inner_url()->host(); 1030 manifest_fs_host = manifest_url.inner_url()->host();
1031 } 1031 }
1032 bool is_hangouts_app = 1032 bool is_hangouts_app =
1033 // Whitelisted apps must be served over secure scheme. 1033 // Whitelisted apps must be served over secure scheme.
1034 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() && 1034 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() &&
1035 manifest_url.inner_url()->SchemeIsCryptographic() && 1035 manifest_url.inner_url()->SchemeIsCryptographic() &&
1036 (EndsWith(app_url_host, "talkgadget.google.com", false) || 1036 (base::EndsWith(app_url_host, "talkgadget.google.com", false) ||
1037 EndsWith(app_url_host, "plus.google.com", false) || 1037 base::EndsWith(app_url_host, "plus.google.com", false) ||
1038 EndsWith(app_url_host, "plus.sandbox.google.com", false)) && 1038 base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) &&
1039 // The manifest must be loaded from the host's FileSystem. 1039 // The manifest must be loaded from the host's FileSystem.
1040 (manifest_fs_host == app_url_host); 1040 (manifest_fs_host == app_url_host);
1041 1041
1042 bool is_whitelisted_app = is_photo_app || is_hangouts_app; 1042 bool is_whitelisted_app = is_photo_app || is_hangouts_app;
1043 1043
1044 bool is_extension_from_webstore = false; 1044 bool is_extension_from_webstore = false;
1045 bool is_invoked_by_hosted_app = false; 1045 bool is_invoked_by_hosted_app = false;
1046 bool is_extension_unrestricted = false; 1046 bool is_extension_unrestricted = false;
1047 #if defined(ENABLE_EXTENSIONS) 1047 #if defined(ENABLE_EXTENSIONS)
1048 is_extension_from_webstore = extension && extension->from_webstore(); 1048 is_extension_from_webstore = extension && extension->from_webstore();
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 } 1502 }
1503 1503
1504 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( 1504 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI(
1505 const GURL& url) { 1505 const GURL& url) {
1506 #if !defined(OS_ANDROID) 1506 #if !defined(OS_ANDROID)
1507 // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check 1507 // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check
1508 // the whitelist in the renderer, since we're only preventing access until 1508 // the whitelist in the renderer, since we're only preventing access until
1509 // these APIs are public and stable. 1509 // these APIs are public and stable.
1510 std::string url_host = url.host(); 1510 std::string url_host = url.host();
1511 if (url.SchemeIs("https") && 1511 if (url.SchemeIs("https") &&
1512 (EndsWith(url_host, "talkgadget.google.com", false) || 1512 (base::EndsWith(url_host, "talkgadget.google.com", false) ||
1513 EndsWith(url_host, "plus.google.com", false) || 1513 base::EndsWith(url_host, "plus.google.com", false) ||
1514 EndsWith(url_host, "plus.sandbox.google.com", false)) && 1514 base::EndsWith(url_host, "plus.sandbox.google.com", false)) &&
1515 base::StartsWithASCII(url.path(), "/hangouts/", false)) { 1515 base::StartsWithASCII(url.path(), "/hangouts/", false)) {
1516 return true; 1516 return true;
1517 } 1517 }
1518 // Allow access for tests. 1518 // Allow access for tests.
1519 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1519 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1520 switches::kEnablePepperTesting)) { 1520 switches::kEnablePepperTesting)) {
1521 return true; 1521 return true;
1522 } 1522 }
1523 #endif // !defined(OS_ANDROID) 1523 #endif // !defined(OS_ANDROID)
1524 return false; 1524 return false;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 WebString header_key(ASCIIToUTF16( 1648 WebString header_key(ASCIIToUTF16(
1649 data_reduction_proxy::chrome_proxy_header())); 1649 data_reduction_proxy::chrome_proxy_header()));
1650 if (!response.httpHeaderField(header_key).isNull() && 1650 if (!response.httpHeaderField(header_key).isNull() &&
1651 response.httpHeaderField(header_key).utf8().find( 1651 response.httpHeaderField(header_key).utf8().find(
1652 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != 1652 data_reduction_proxy::chrome_proxy_lo_fi_directive()) !=
1653 std::string::npos) { 1653 std::string::npos) {
1654 (*properties)[data_reduction_proxy::chrome_proxy_header()] = 1654 (*properties)[data_reduction_proxy::chrome_proxy_header()] =
1655 data_reduction_proxy::chrome_proxy_lo_fi_directive(); 1655 data_reduction_proxy::chrome_proxy_lo_fi_directive();
1656 } 1656 }
1657 } 1657 }
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698