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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 852573002: Tag SecurityContext objects as being hosted in reserved IP ranges. [2/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_impl_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void AppendAsTraceFormat(std::string* out) const override { 147 void AppendAsTraceFormat(std::string* out) const override {
148 *out += convertable_.asTraceFormat().utf8(); 148 *out += convertable_.asTraceFormat().utf8();
149 } 149 }
150 150
151 private: 151 private:
152 ~ConvertableToTraceFormatWrapper() override {} 152 ~ConvertableToTraceFormatWrapper() override {}
153 153
154 blink::WebConvertableToTraceFormat convertable_; 154 blink::WebConvertableToTraceFormat convertable_;
155 }; 155 };
156 156
157 bool isHostnameReservedIPAddress(const std::string& host) {
158 net::IPAddressNumber address;
159 if (!net::ParseURLHostnameToNumber(host, &address))
160 return false;
161 return net::IsIPAddressReserved(address);
162 }
163
164 } // namespace 157 } // namespace
165 158
166 static int ToMessageID(WebLocalizedString::Name name) { 159 static int ToMessageID(WebLocalizedString::Name name) {
167 switch (name) { 160 switch (name) {
168 case WebLocalizedString::AXAMPMFieldText: 161 case WebLocalizedString::AXAMPMFieldText:
169 return IDS_AX_AM_PM_FIELD_TEXT; 162 return IDS_AX_AM_PM_FIELD_TEXT;
170 case WebLocalizedString::AXButtonActionVerb: 163 case WebLocalizedString::AXButtonActionVerb:
171 return IDS_AX_BUTTON_ACTION_VERB; 164 return IDS_AX_BUTTON_ACTION_VERB;
172 case WebLocalizedString::AXCalendarShowMonthSelector: 165 case WebLocalizedString::AXCalendarShowMonthSelector:
173 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR; 166 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 484 }
492 return WebData(); 485 return WebData();
493 } 486 }
494 487
495 WebURLError BlinkPlatformImpl::cancelledError( 488 WebURLError BlinkPlatformImpl::cancelledError(
496 const WebURL& unreachableURL) const { 489 const WebURL& unreachableURL) const {
497 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED); 490 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED);
498 } 491 }
499 492
500 bool BlinkPlatformImpl::isReservedIPAddress( 493 bool BlinkPlatformImpl::isReservedIPAddress(
501 const blink::WebSecurityOrigin& securityOrigin) const { 494 const blink::WebString& host) const {
502 return isHostnameReservedIPAddress(securityOrigin.host().utf8()); 495 net::IPAddressNumber address;
503 } 496 if (!net::ParseURLHostnameToNumber(host.utf8(), &address))
504 497 return false;
505 bool BlinkPlatformImpl::isReservedIPAddress(const blink::WebURL& url) const { 498 return net::IsIPAddressReserved(address);
506 return isHostnameReservedIPAddress(GURL(url).host());
507 } 499 }
508 500
509 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { 501 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
510 return new WebThreadImpl(name); 502 return new WebThreadImpl(name);
511 } 503 }
512 504
513 blink::WebThread* BlinkPlatformImpl::currentThread() { 505 blink::WebThread* BlinkPlatformImpl::currentThread() {
514 WebThreadImplForMessageLoop* thread = 506 WebThreadImplForMessageLoop* thread =
515 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); 507 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
516 if (thread) 508 if (thread)
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 } 1239 }
1248 1240
1249 // static 1241 // static
1250 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1242 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1251 WebThreadImplForMessageLoop* impl = 1243 WebThreadImplForMessageLoop* impl =
1252 static_cast<WebThreadImplForMessageLoop*>(thread); 1244 static_cast<WebThreadImplForMessageLoop*>(thread);
1253 delete impl; 1245 delete impl;
1254 } 1246 }
1255 1247
1256 } // namespace content 1248 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698