OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/url_utils.h" | 5 #include "content/public/common/url_utils.h" |
6 | 6 |
7 #include "base/base_switches.h" | |
8 #include "base/command_line.h" | |
9 #include "base/logging.h" | |
7 #include "build/build_config.h" | 10 #include "build/build_config.h" |
8 #include "content/common/savable_url_schemes.h" | 11 #include "content/common/savable_url_schemes.h" |
12 #include "content/public/common/content_switches.h" | |
9 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
10 #include "url/gurl.h" | 14 #include "url/gurl.h" |
11 | 15 |
12 namespace content { | 16 namespace content { |
13 | 17 |
18 static size_t g_max_url_size = 2 * 1024 * 1024; | |
19 | |
14 const char* const* GetSavableSchemes() { | 20 const char* const* GetSavableSchemes() { |
15 return GetSavableSchemesInternal(); | 21 return GetSavableSchemesInternal(); |
16 } | 22 } |
17 | 23 |
18 bool HasWebUIScheme(const GURL& url) { | 24 bool HasWebUIScheme(const GURL& url) { |
19 return | 25 return |
20 #if !defined(OS_IOS) | 26 #if !defined(OS_IOS) |
21 url.SchemeIs(chrome::kChromeDevToolsScheme) || | 27 url.SchemeIs(chrome::kChromeDevToolsScheme) || |
22 url.SchemeIs(chrome::kChromeInternalScheme) || | 28 url.SchemeIs(chrome::kChromeInternalScheme) || |
23 #endif | 29 #endif |
24 url.SchemeIs(chrome::kChromeUIScheme); | 30 url.SchemeIs(chrome::kChromeUIScheme); |
25 } | 31 } |
26 | 32 |
27 bool IsSavableURL(const GURL& url) { | 33 bool IsSavableURL(const GURL& url) { |
28 for (int i = 0; GetSavableSchemes()[i] != NULL; ++i) { | 34 for (int i = 0; GetSavableSchemes()[i] != NULL; ++i) { |
29 if (url.SchemeIs(GetSavableSchemes()[i])) | 35 if (url.SchemeIs(GetSavableSchemes()[i])) |
30 return true; | 36 return true; |
31 } | 37 } |
32 return false; | 38 return false; |
33 } | 39 } |
34 | 40 |
41 #if defined(OS_ANDROID) | |
42 void SetMaxURLChars(size_t max_chars) { | |
43 // Check that it is not used by a multiprocesses | |
44 // embedder | |
jam
2013/12/16 17:40:36
nit: why wrap at less than 80?
Kristian Monsen
2013/12/16 18:27:39
Done.
| |
45 CommandLine* cmd = CommandLine::ForCurrentProcess(); | |
46 CHECK(cmd->HasSwitch(switches::kSingleProcess)); | |
47 g_max_url_size = max_chars; | |
48 } | |
49 #endif | |
50 | |
51 size_t GetMaxURLChars() { | |
52 return g_max_url_size; | |
53 } | |
54 | |
35 } // namespace content | 55 } // namespace content |
OLD | NEW |