Index: content/browser/browser_url_handler_impl.h |
=================================================================== |
--- content/browser/browser_url_handler_impl.h (revision 126145) |
+++ content/browser/browser_url_handler_impl.h (working copy) |
@@ -2,15 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// We handle some special browser-level URLs (like "about:version") |
-// before they're handed to a renderer. This lets us do the URL handling |
-// on the browser side (which has access to more information than the |
-// renderers do) as well as sidestep the risk of exposing data to |
-// random web pages (because from the resource loader's perspective, these |
-// URL schemes don't exist). |
- |
-#ifndef CONTENT_BROWSER_BROWSER_URL_HANDLER_H_ |
-#define CONTENT_BROWSER_BROWSER_URL_HANDLER_H_ |
+#ifndef CONTENT_BROWSER_BROWSER_URL_HANDLER_IMPL_H_ |
+#define CONTENT_BROWSER_BROWSER_URL_HANDLER_IMPL_H_ |
#pragma once |
#include <vector> |
@@ -18,7 +11,7 @@ |
#include "base/gtest_prod_util.h" |
#include "base/memory/singleton.h" |
-#include "content/common/content_export.h" |
+#include "content/public/browser/browser_url_handler.h" |
class GURL; |
@@ -26,52 +19,37 @@ |
class BrowserContext; |
} |
-// BrowserURLHandler manages the list of all special URLs and manages |
-// dispatching the URL handling to registered handlers. |
-class CONTENT_EXPORT BrowserURLHandler { |
+class CONTENT_EXPORT BrowserURLHandlerImpl : public content::BrowserURLHandler { |
public: |
- // 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 |
- // If the URL is not handled by a handler, it should return false. |
- typedef bool (*URLHandler)(GURL* url, |
- content::BrowserContext* browser_context); |
- |
// Returns the singleton instance. |
- static BrowserURLHandler* GetInstance(); |
+ static BrowserURLHandlerImpl* GetInstance(); |
- // RewriteURLIfNecessary gives all registered URLHandlers a shot at processing |
- // the given URL, and modifies it in place. |
- // If the original URL needs to be adjusted if the modified URL is redirected, |
- // this function sets |reverse_on_redirect| to true. |
- void RewriteURLIfNecessary(GURL* url, |
- content::BrowserContext* browser_context, |
- bool* reverse_on_redirect); |
+ // BrowserURLHandler implementation: |
+ virtual void RewriteURLIfNecessary(GURL* url, |
+ content::BrowserContext* browser_context, |
+ bool* reverse_on_redirect) OVERRIDE; |
+ // Add the specified handler pair to the list of URL handlers. |
+ virtual void AddHandlerPair(URLHandler handler, |
+ URLHandler reverse_handler) OVERRIDE; |
// Reverses the rewriting that was done for |original| using the new |url|. |
bool ReverseURLRewrite(GURL* url, const GURL& original, |
content::BrowserContext* browser_context); |
- // Add the specified handler pair to the list of URL handlers. |
- void AddHandlerPair(URLHandler handler, URLHandler reverse_handler); |
- |
- // Returns the null handler for use with |AddHandlerPair()|. |
- static URLHandler null_handler(); |
- |
private: |
// This object is a singleton: |
- BrowserURLHandler(); |
- ~BrowserURLHandler(); |
- friend struct DefaultSingletonTraits<BrowserURLHandler>; |
+ BrowserURLHandlerImpl(); |
+ virtual ~BrowserURLHandlerImpl(); |
+ friend struct DefaultSingletonTraits<BrowserURLHandlerImpl>; |
// The list of known URLHandlers, optionally with reverse-rewriters. |
typedef std::pair<URLHandler, URLHandler> HandlerPair; |
std::vector<HandlerPair> url_handlers_; |
- FRIEND_TEST_ALL_PREFIXES(BrowserURLHandlerTest, BasicRewriteAndReverse); |
- FRIEND_TEST_ALL_PREFIXES(BrowserURLHandlerTest, NullHandlerReverse); |
+ FRIEND_TEST_ALL_PREFIXES(BrowserURLHandlerImplTest, BasicRewriteAndReverse); |
+ FRIEND_TEST_ALL_PREFIXES(BrowserURLHandlerImplTest, NullHandlerReverse); |
- DISALLOW_COPY_AND_ASSIGN(BrowserURLHandler); |
+ DISALLOW_COPY_AND_ASSIGN(BrowserURLHandlerImpl); |
}; |
-#endif // CONTENT_BROWSER_BROWSER_URL_HANDLER_H_ |
+#endif // CONTENT_BROWSER_BROWSER_URL_HANDLER_IMPL_H_ |