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

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: Layering. 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
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/websocket_bridge.h" 35 #include "content/child/websocket_bridge.h"
36 #include "content/child/webthread_impl.h" 36 #include "content/child/webthread_impl.h"
37 #include "content/child/worker_task_runner.h" 37 #include "content/child/worker_task_runner.h"
38 #include "content/public/common/content_client.h" 38 #include "content/public/common/content_client.h"
39 #include "grit/blink_resources.h" 39 #include "grit/blink_resources.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"
53 #include "url/url_canon_ip.h"
Ryan Sleevi 2014/08/06 19:42:12 Not needed?
Mike West 2014/08/08 08:15:03 Done.
50 54
51 #if defined(OS_ANDROID) 55 #if defined(OS_ANDROID)
52 #include "content/child/fling_animator_impl_android.h" 56 #include "content/child/fling_animator_impl_android.h"
53 #endif 57 #endif
54 58
55 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) 59 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
56 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 60 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
57 #endif 61 #endif
58 62
59 using blink::WebData; 63 using blink::WebData;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { 148 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
145 *out += convertable_.asTraceFormat().utf8(); 149 *out += convertable_.asTraceFormat().utf8();
146 } 150 }
147 151
148 private: 152 private:
149 virtual ~ConvertableToTraceFormatWrapper() {} 153 virtual ~ConvertableToTraceFormatWrapper() {}
150 154
151 blink::WebConvertableToTraceFormat convertable_; 155 blink::WebConvertableToTraceFormat convertable_;
152 }; 156 };
153 157
158 bool isHostnameReservedIPAddress(const std::string& host) {
159 net::IPAddressNumber address;
160 if (!net::ParseURLHostnameToNumber(host, &address))
161 return false;
162 return net::IsIPAddressReserved(address);
163 }
164
154 } // namespace 165 } // namespace
155 166
156 static int ToMessageID(WebLocalizedString::Name name) { 167 static int ToMessageID(WebLocalizedString::Name name) {
157 switch (name) { 168 switch (name) {
158 case WebLocalizedString::AXAMPMFieldText: 169 case WebLocalizedString::AXAMPMFieldText:
159 return IDS_AX_AM_PM_FIELD_TEXT; 170 return IDS_AX_AM_PM_FIELD_TEXT;
160 case WebLocalizedString::AXButtonActionVerb: 171 case WebLocalizedString::AXButtonActionVerb:
161 return IDS_AX_BUTTON_ACTION_VERB; 172 return IDS_AX_BUTTON_ACTION_VERB;
162 case WebLocalizedString::AXCheckedCheckBoxActionVerb: 173 case WebLocalizedString::AXCheckedCheckBoxActionVerb:
163 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; 174 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return data; 443 return data;
433 } 444 }
434 return WebData(); 445 return WebData();
435 } 446 }
436 447
437 WebURLError BlinkPlatformImpl::cancelledError( 448 WebURLError BlinkPlatformImpl::cancelledError(
438 const WebURL& unreachableURL) const { 449 const WebURL& unreachableURL) const {
439 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED); 450 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED);
440 } 451 }
441 452
453 bool BlinkPlatformImpl::isReservedIPAddress(
454 const blink::WebSecurityOrigin& securityOrigin) const {
455 return isHostnameReservedIPAddress(securityOrigin.host().utf8());
456 }
457
458 bool BlinkPlatformImpl::isReservedIPAddress(const blink::WebURL& url) const {
459 return isHostnameReservedIPAddress(GURL(url).host());
460 }
461
442 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { 462 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
443 return new WebThreadImpl(name); 463 return new WebThreadImpl(name);
444 } 464 }
445 465
446 blink::WebThread* BlinkPlatformImpl::currentThread() { 466 blink::WebThread* BlinkPlatformImpl::currentThread() {
447 WebThreadImplForMessageLoop* thread = 467 WebThreadImplForMessageLoop* thread =
448 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); 468 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
449 if (thread) 469 if (thread)
450 return (thread); 470 return (thread);
451 471
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1178 }
1159 1179
1160 // static 1180 // static
1161 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1181 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1162 WebThreadImplForMessageLoop* impl = 1182 WebThreadImplForMessageLoop* impl =
1163 static_cast<WebThreadImplForMessageLoop*>(thread); 1183 static_cast<WebThreadImplForMessageLoop*>(thread);
1164 delete impl; 1184 delete impl;
1165 } 1185 }
1166 1186
1167 } // namespace content 1187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698