Home | History | Annotate | Download | only in common
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_PUBLIC_COMMON_URL_UTILS_H_
      6 #define CONTENT_PUBLIC_COMMON_URL_UTILS_H_
      7 
      8 #include <stddef.h>         // For size_t
      9 
     10 #include "build/build_config.h"
     11 #include "content/common/content_export.h"
     12 
     13 class GURL;
     14 
     15 namespace content {
     16 
     17 // Null terminated list of schemes that are savable. This function can be
     18 // invoked on any thread.
     19 CONTENT_EXPORT const char* const* GetSavableSchemes();
     20 
     21 // Returns true if the url has a scheme for WebUI.  See also
     22 // WebUIControllerFactory::UseWebUIForURL in the browser process.
     23 CONTENT_EXPORT bool HasWebUIScheme(const GURL& url);
     24 
     25 // Check whether we can do the saving page operation for the specified URL.
     26 CONTENT_EXPORT bool IsSavableURL(const GURL& url);
     27 
     28 #if defined(OS_ANDROID)
     29 // Set a new max size for URL's that we are willing to accept in the browser
     30 // process.
     31 // Should not be used except by Android WebView for backwards compatibility.
     32 // Should be called early in start up before forking child processes.
     33 //
     34 // This is for supporting legacy android apps, android webview needs to
     35 // support loading long data urls. In chrome, the url length is limited to 2M to
     36 // prevent renderer process DOS-ing the browser process. So only for android
     37 // webview, increase the limit to 20M, which is a large enough value to satisfy
     38 // legacy app compatibility requirements.
     39 CONTENT_EXPORT void SetMaxURLChars(size_t max_chars);
     40 #endif
     41 
     42 // The maximum number of characters in the URL that we're willing to accept
     43 // in the browser process. It is set low enough to avoid damage to the browser
     44 // but high enough that a web site can abuse location.hash for a little storage.
     45 // We have different values for "max accepted" and "max displayed" because
     46 // a data: URI may be legitimately massive, but the full URI would kill all
     47 // known operating systems if you dropped it into a UI control.
     48 CONTENT_EXPORT size_t GetMaxURLChars();
     49 
     50 }  // namespace content
     51 
     52 #endif  // CONTENT_PUBLIC_COMMON_URL_UTILS_H_
     53