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

Side by Side Diff: content/public/common/common_param_traits.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the test Created 5 years 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/public/browser/navigation_entry.h ('k') | content/public/common/content_constants.h » ('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 (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/public/common/common_param_traits.h" 5 #include "content/public/common/common_param_traits.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/common/content_constants.h" 9 #include "content/public/common/content_constants.h"
10 #include "content/public/common/page_state.h" 10 #include "content/public/common/page_state.h"
11 #include "content/public/common/referrer.h" 11 #include "content/public/common/referrer.h"
12 #include "content/public/common/url_utils.h"
13 #include "net/base/host_port_pair.h" 12 #include "net/base/host_port_pair.h"
14 #include "net/base/ip_endpoint.h" 13 #include "net/base/ip_endpoint.h"
15 14
16 namespace IPC { 15 namespace IPC {
17 16
18 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { 17 void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
19 if (p.possibly_invalid_spec().length() > content::GetMaxURLChars()) { 18 if (p.possibly_invalid_spec().length() > content::kMaxURLChars) {
20 m->WriteString(std::string()); 19 m->WriteString(std::string());
21 return; 20 return;
22 } 21 }
23 22
24 // Beware of print-parse inconsistency which would change an invalid 23 // Beware of print-parse inconsistency which would change an invalid
25 // URL into a valid one. Ideally, the message would contain this flag 24 // URL into a valid one. Ideally, the message would contain this flag
26 // so that the read side could make the check, but performing it here 25 // so that the read side could make the check, but performing it here
27 // avoids changing the on-the-wire representation of such a fundamental 26 // avoids changing the on-the-wire representation of such a fundamental
28 // type as GURL. See https://crbug.com/166486 for additional work in 27 // type as GURL. See https://crbug.com/166486 for additional work in
29 // this area. 28 // this area.
30 if (!p.is_valid()) { 29 if (!p.is_valid()) {
31 m->WriteString(std::string()); 30 m->WriteString(std::string());
32 return; 31 return;
33 } 32 }
34 33
35 m->WriteString(p.possibly_invalid_spec()); 34 m->WriteString(p.possibly_invalid_spec());
36 // TODO(brettw) bug 684583: Add encoding for query params. 35 // TODO(brettw) bug 684583: Add encoding for query params.
37 } 36 }
38 37
39 bool ParamTraits<GURL>::Read(const Message* m, 38 bool ParamTraits<GURL>::Read(const Message* m,
40 base::PickleIterator* iter, 39 base::PickleIterator* iter,
41 GURL* p) { 40 GURL* p) {
42 std::string s; 41 std::string s;
43 if (!iter->ReadString(&s) || s.length() > content::GetMaxURLChars()) { 42 if (!iter->ReadString(&s) || s.length() > content::kMaxURLChars) {
44 *p = GURL(); 43 *p = GURL();
45 return false; 44 return false;
46 } 45 }
47 *p = GURL(s); 46 *p = GURL(s);
48 if (!s.empty() && !p->is_valid()) { 47 if (!s.empty() && !p->is_valid()) {
49 *p = GURL(); 48 *p = GURL();
50 return false; 49 return false;
51 } 50 }
52 return true; 51 return true;
53 } 52 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ 176 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
178 #include "content/public/common/common_param_traits_macros.h" 177 #include "content/public/common/common_param_traits_macros.h"
179 } // namespace IPC 178 } // namespace IPC
180 179
181 // Generate param traits log methods. 180 // Generate param traits log methods.
182 #include "ipc/param_traits_log_macros.h" 181 #include "ipc/param_traits_log_macros.h"
183 namespace IPC { 182 namespace IPC {
184 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ 183 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
185 #include "content/public/common/common_param_traits_macros.h" 184 #include "content/public/common/common_param_traits_macros.h"
186 } // namespace IPC 185 } // namespace IPC
OLDNEW
« no previous file with comments | « content/public/browser/navigation_entry.h ('k') | content/public/common/content_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698