Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "content/common/url_schemes.h" | 5 #include "content/common/url_schemes.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | |
| 15 #include "content/common/savable_url_schemes.h" | 16 #include "content/common/savable_url_schemes.h" |
| 16 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 17 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 19 #include "net/base/net_util.h" | |
| 20 #include "third_party/WebKit/public/platform/WebString.h" | |
| 21 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | |
| 22 #include "url/gurl.h" | |
| 18 #include "url/url_util.h" | 23 #include "url/url_util.h" |
| 19 | 24 |
| 20 namespace { | 25 namespace { |
| 21 | 26 |
| 22 void AddStandardSchemeHelper(const std::string& scheme) { | 27 void AddStandardSchemeHelper(const std::string& scheme) { |
| 23 url::AddStandardScheme(scheme.c_str()); | 28 url::AddStandardScheme(scheme.c_str()); |
| 24 } | 29 } |
| 25 | 30 |
| 26 } // namespace | 31 } // namespace |
| 27 | 32 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 for (int i = 0; i < schemes; ++i) { | 72 for (int i = 0; i < schemes; ++i) { |
| 68 savable_schemes[default_schemes_count + i] = | 73 savable_schemes[default_schemes_count + i] = |
| 69 base::strdup(additional_savable_schemes[i].c_str()); | 74 base::strdup(additional_savable_schemes[i].c_str()); |
| 70 } | 75 } |
| 71 savable_schemes[default_schemes_count + schemes] = 0; | 76 savable_schemes[default_schemes_count + schemes] = 0; |
| 72 | 77 |
| 73 SetSavableSchemes(savable_schemes); | 78 SetSavableSchemes(savable_schemes); |
| 74 } | 79 } |
| 75 } | 80 } |
| 76 | 81 |
| 82 bool IsOriginSecure(const GURL& url) { | |
| 83 if (url.SchemeIsSecure()) | |
| 84 return true; | |
| 85 | |
| 86 std::string hostname = url.host(); | |
| 87 if (net::IsLocalhost(hostname) || net::IsLocalhostTLD(hostname)) | |
| 88 return true; | |
| 89 | |
| 90 blink::WebString scheme(base::ASCIIToUTF16(url.scheme())); | |
| 91 if (blink::WebSecurityPolicy::shouldTreatURLSchemeAsSecure(scheme)) | |
|
tkent
2015/04/05 22:31:38
Does this code run in the browser process? If so,
| |
| 92 return true; | |
| 93 | |
| 94 return false; | |
| 95 } | |
| 96 | |
| 77 } // namespace content | 97 } // namespace content |
| OLD | NEW |