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

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

Issue 459363002: Revert of Wire 'blink::Platform::isHostnameReservedIPAddress()' to 'net::IsReservedIPAddress()'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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"
46 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" 45 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h"
47 #include "third_party/WebKit/public/platform/WebData.h" 46 #include "third_party/WebKit/public/platform/WebData.h"
48 #include "third_party/WebKit/public/platform/WebString.h" 47 #include "third_party/WebKit/public/platform/WebString.h"
49 #include "third_party/WebKit/public/platform/WebURL.h"
50 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 48 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
51 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
52 #include "ui/base/layout.h" 49 #include "ui/base/layout.h"
53 50
54 #if defined(OS_ANDROID) 51 #if defined(OS_ANDROID)
55 #include "content/child/fling_animator_impl_android.h" 52 #include "content/child/fling_animator_impl_android.h"
56 #endif 53 #endif
57 54
58 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) 55 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
59 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 56 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
60 #endif 57 #endif
61 58
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { 144 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
148 *out += convertable_.asTraceFormat().utf8(); 145 *out += convertable_.asTraceFormat().utf8();
149 } 146 }
150 147
151 private: 148 private:
152 virtual ~ConvertableToTraceFormatWrapper() {} 149 virtual ~ConvertableToTraceFormatWrapper() {}
153 150
154 blink::WebConvertableToTraceFormat convertable_; 151 blink::WebConvertableToTraceFormat convertable_;
155 }; 152 };
156 153
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 154 } // namespace
165 155
166 static int ToMessageID(WebLocalizedString::Name name) { 156 static int ToMessageID(WebLocalizedString::Name name) {
167 switch (name) { 157 switch (name) {
168 case WebLocalizedString::AXAMPMFieldText: 158 case WebLocalizedString::AXAMPMFieldText:
169 return IDS_AX_AM_PM_FIELD_TEXT; 159 return IDS_AX_AM_PM_FIELD_TEXT;
170 case WebLocalizedString::AXButtonActionVerb: 160 case WebLocalizedString::AXButtonActionVerb:
171 return IDS_AX_BUTTON_ACTION_VERB; 161 return IDS_AX_BUTTON_ACTION_VERB;
172 case WebLocalizedString::AXCheckedCheckBoxActionVerb: 162 case WebLocalizedString::AXCheckedCheckBoxActionVerb:
173 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; 163 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 return data; 432 return data;
443 } 433 }
444 return WebData(); 434 return WebData();
445 } 435 }
446 436
447 WebURLError BlinkPlatformImpl::cancelledError( 437 WebURLError BlinkPlatformImpl::cancelledError(
448 const WebURL& unreachableURL) const { 438 const WebURL& unreachableURL) const {
449 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED); 439 return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED);
450 } 440 }
451 441
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
461 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { 442 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
462 return new WebThreadImpl(name); 443 return new WebThreadImpl(name);
463 } 444 }
464 445
465 blink::WebThread* BlinkPlatformImpl::currentThread() { 446 blink::WebThread* BlinkPlatformImpl::currentThread() {
466 WebThreadImplForMessageLoop* thread = 447 WebThreadImplForMessageLoop* thread =
467 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); 448 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
468 if (thread) 449 if (thread)
469 return (thread); 450 return (thread);
470 451
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1158 }
1178 1159
1179 // static 1160 // static
1180 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1161 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1181 WebThreadImplForMessageLoop* impl = 1162 WebThreadImplForMessageLoop* impl =
1182 static_cast<WebThreadImplForMessageLoop*>(thread); 1163 static_cast<WebThreadImplForMessageLoop*>(thread);
1183 delete impl; 1164 delete impl;
1184 } 1165 }
1185 1166
1186 } // namespace content 1167 } // 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