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

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

Issue 430193002: Wire 'blink::Platform::isHostnameReservedIPAddress()' to 'net::IsReservedIPAddress()'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_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 24 matching lines...) Expand all
35 #include "content/child/web_url_loader_impl.h" 35 #include "content/child/web_url_loader_impl.h"
36 #include "content/child/websocket_bridge.h" 36 #include "content/child/websocket_bridge.h"
37 #include "content/child/webthread_impl.h" 37 #include "content/child/webthread_impl.h"
38 #include "content/child/worker_task_runner.h" 38 #include "content/child/worker_task_runner.h"
39 #include "content/public/common/content_client.h" 39 #include "content/public/common/content_client.h"
40 #include "grit/webkit_resources.h" 40 #include "grit/webkit_resources.h"
41 #include "grit/webkit_strings.h" 41 #include "grit/webkit_strings.h"
42 #include "net/base/data_url.h" 42 #include "net/base/data_url.h"
43 #include "net/base/mime_util.h" 43 #include "net/base/mime_util.h"
44 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
45 #include "net/base/net_util.h"
45 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" 46 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h"
46 #include "third_party/WebKit/public/platform/WebData.h" 47 #include "third_party/WebKit/public/platform/WebData.h"
47 #include "third_party/WebKit/public/platform/WebString.h" 48 #include "third_party/WebKit/public/platform/WebString.h"
49 #include "third_party/WebKit/public/platform/WebURL.h"
48 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 50 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
51 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
49 #include "ui/base/layout.h" 52 #include "ui/base/layout.h"
50 53
51 #if defined(OS_ANDROID) 54 #if defined(OS_ANDROID)
52 #include "content/child/fling_animator_impl_android.h" 55 #include "content/child/fling_animator_impl_android.h"
53 #endif 56 #endif
54 57
55 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) 58 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
56 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 59 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
57 #endif 60 #endif
58 61
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { 147 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
145 *out += convertable_.asTraceFormat().utf8(); 148 *out += convertable_.asTraceFormat().utf8();
146 } 149 }
147 150
148 private: 151 private:
149 virtual ~ConvertableToTraceFormatWrapper() {} 152 virtual ~ConvertableToTraceFormatWrapper() {}
150 153
151 blink::WebConvertableToTraceFormat convertable_; 154 blink::WebConvertableToTraceFormat convertable_;
152 }; 155 };
153 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
154 } // namespace 164 } // namespace
155 165
156 static int ToMessageID(WebLocalizedString::Name name) { 166 static int ToMessageID(WebLocalizedString::Name name) {
157 switch (name) { 167 switch (name) {
158 case WebLocalizedString::AXAMPMFieldText: 168 case WebLocalizedString::AXAMPMFieldText:
159 return IDS_AX_AM_PM_FIELD_TEXT; 169 return IDS_AX_AM_PM_FIELD_TEXT;
160 case WebLocalizedString::AXButtonActionVerb: 170 case WebLocalizedString::AXButtonActionVerb:
161 return IDS_AX_BUTTON_ACTION_VERB; 171 return IDS_AX_BUTTON_ACTION_VERB;
162 case WebLocalizedString::AXCheckedCheckBoxActionVerb: 172 case WebLocalizedString::AXCheckedCheckBoxActionVerb:
163 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; 173 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return data; 442 return data;
433 } 443 }
434 return WebData(); 444 return WebData();
435 } 445 }
436 446
437 WebURLError BlinkPlatformImpl::cancelledError( 447 WebURLError BlinkPlatformImpl::cancelledError(
438 const WebURL& unreachableURL) const { 448 const WebURL& unreachableURL) const {
439 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED); 449 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED);
440 } 450 }
441 451
452 bool BlinkPlatformImpl::isReservedIPAddress(
453 const blink::WebSecurityOrigin& securityOrigin) const {
454 return isHostnameReservedIPAddress(securityOrigin.host().utf8());
455 }
456
457 bool BlinkPlatformImpl::isReservedIPAddress(const blink::WebURL& url) const {
458 return isHostnameReservedIPAddress(GURL(url).host());
459 }
460
442 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { 461 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
443 return new WebThreadImpl(name); 462 return new WebThreadImpl(name);
444 } 463 }
445 464
446 blink::WebThread* BlinkPlatformImpl::currentThread() { 465 blink::WebThread* BlinkPlatformImpl::currentThread() {
447 WebThreadImplForMessageLoop* thread = 466 WebThreadImplForMessageLoop* thread =
448 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); 467 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
449 if (thread) 468 if (thread)
450 return (thread); 469 return (thread);
451 470
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1177 }
1159 1178
1160 // static 1179 // static
1161 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1180 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1162 WebThreadImplForMessageLoop* impl = 1181 WebThreadImplForMessageLoop* impl =
1163 static_cast<WebThreadImplForMessageLoop*>(thread); 1182 static_cast<WebThreadImplForMessageLoop*>(thread);
1164 delete impl; 1183 delete impl;
1165 } 1184 }
1166 1185
1167 } // namespace content 1186 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/blink_platform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698