diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 18:58:32 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 18:58:32 +0000 |
commit | 38178a40098824ecafd6d81e9f19631acaf37c75 (patch) | |
tree | 7f051b0d8d818cca8766919f43b91796a5f5e27f /chrome/browser/browser_url_handler.h | |
parent | 501ebf0409b21006e224116a324f18ad94edc725 (diff) | |
download | chromium_src-38178a40098824ecafd6d81e9f19631acaf37c75.zip chromium_src-38178a40098824ecafd6d81e9f19631acaf37c75.tar.gz chromium_src-38178a40098824ecafd6d81e9f19631acaf37c75.tar.bz2 |
Allow rewriting of URLs to be reversed in some cases, so that if the underlying renderer URL changes, the virtual URL displayed in the address bar can be updated to reflect that. Currently apply that technique only to view-source rewrites, so it will follow redirects.
BUG=19444
TEST=go to view-source:http://crbug.com
Review URL: http://codereview.chromium.org/493001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_url_handler.h')
-rw-r--r-- | chrome/browser/browser_url_handler.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/chrome/browser/browser_url_handler.h b/chrome/browser/browser_url_handler.h index 593408e..e8b8a97 100644 --- a/chrome/browser/browser_url_handler.h +++ b/chrome/browser/browser_url_handler.h @@ -13,6 +13,7 @@ #define CHROME_BROWSER_BROWSER_URL_HANDLER_H_ #include <vector> +#include <utility> class GURL; class Profile; @@ -24,21 +25,27 @@ class BrowserURLHandler { // The type of functions that can process a URL. // If a handler handles |url|, it should : // - optionally modify |url| to the URL that should be sent to the renderer - // - optionally set |dispatcher| to the necessary DOMMessageDispatcher - // - return true. // If the URL is not handled by a handler, it should return false. typedef bool (*URLHandler)(GURL* url, Profile* profile); - // HandleBrowserURL gives all registered URLHandlers a shot at processing + // RewriteURLIfNecessary gives all registered URLHandlers a shot at processing // the given URL, and modifies it in place. - static void RewriteURLIfNecessary(GURL* url, Profile* profile); + // If the original URL needs to be adjusted if the modified URL is redirected, + // this function sets |reverse_on_redirect| to true. + static void RewriteURLIfNecessary(GURL* url, Profile* profile, + bool* reverse_on_redirect); - // We initialize the list of url_handlers_ lazily the first time MaybeHandle - // is called. + // Reverses the rewriting that was done for |original| using the new |url|. + static bool ReverseURLRewrite(GURL* url, const GURL& original, + Profile* profile); + + // We initialize the list of url_handlers_ lazily the first time + // RewriteURLIfNecessary is called. static void InitURLHandlers(); - // The list of known URLHandlers. - static std::vector<URLHandler> url_handlers_; + // The list of known URLHandlers, optionally with reverse-rewriters. + typedef std::pair<URLHandler, URLHandler> HandlerPair; + static std::vector<HandlerPair> url_handlers_; }; #endif // CHROME_BROWSER_BROWSER_URL_HANDLER_H_ |