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

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

Issue 112053002: Allow the max url length to be overridden (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually using the new API in AWV Created 7 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 | Annotate | Revision Log
OLDNEW
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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/common/savable_url_schemes.h" 8 #include "content/common/savable_url_schemes.h"
9 #include "content/public/common/url_constants.h" 9 #include "content/public/common/url_constants.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 static size_t g_maxUrlSize = 2 * 1024 * 1024;
boliu 2013/12/10 21:35:44 g_max_url_size
Kristian Monsen 2013/12/10 21:42:07 Done.
15
14 const char* const* GetSavableSchemes() { 16 const char* const* GetSavableSchemes() {
15 return GetSavableSchemesInternal(); 17 return GetSavableSchemesInternal();
16 } 18 }
17 19
18 bool HasWebUIScheme(const GURL& url) { 20 bool HasWebUIScheme(const GURL& url) {
19 return 21 return
20 #if !defined(OS_IOS) 22 #if !defined(OS_IOS)
21 url.SchemeIs(chrome::kChromeDevToolsScheme) || 23 url.SchemeIs(chrome::kChromeDevToolsScheme) ||
22 url.SchemeIs(chrome::kChromeInternalScheme) || 24 url.SchemeIs(chrome::kChromeInternalScheme) ||
23 #endif 25 #endif
24 url.SchemeIs(chrome::kChromeUIScheme); 26 url.SchemeIs(chrome::kChromeUIScheme);
25 } 27 }
26 28
27 bool IsSavableURL(const GURL& url) { 29 bool IsSavableURL(const GURL& url) {
28 for (int i = 0; GetSavableSchemes()[i] != NULL; ++i) { 30 for (int i = 0; GetSavableSchemes()[i] != NULL; ++i) {
29 if (url.SchemeIs(GetSavableSchemes()[i])) 31 if (url.SchemeIs(GetSavableSchemes()[i]))
30 return true; 32 return true;
31 } 33 }
32 return false; 34 return false;
33 } 35 }
34 36
37 void SetMaxURLChars(size_t maxChars) {
38 g_maxUrlSize = maxChars;
39 }
40
41 size_t MaxURLChars() {
42 return g_maxUrlSize;
43 }
44
35 } // namespace content 45 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698