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

Side by Side Diff: chrome/browser/browser_url_handler.h

Issue 174277: override chrome:// URLs via extensions. (Closed)
Patch Set: fix linux errors Created 11 years, 3 months 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
« no previous file with comments | « chrome/browser/browser_prefs.cc ('k') | chrome/browser/browser_url_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // We handle some special browser-level URLs (like "about:version") 5 // We handle some special browser-level URLs (like "about:version")
6 // before they're handed to a renderer. This lets us do the URL handling 6 // before they're handed to a renderer. This lets us do the URL handling
7 // on the browser side (which has access to more information than the 7 // on the browser side (which has access to more information than the
8 // renderers do) as well as sidestep the risk of exposing data to 8 // renderers do) as well as sidestep the risk of exposing data to
9 // random web pages (because from the resource loader's perspective, these 9 // random web pages (because from the resource loader's perspective, these
10 // URL schemes don't exist). 10 // URL schemes don't exist).
11 11
12 #ifndef CHROME_BROWSER_BROWSER_URL_HANDLER_H_ 12 #ifndef CHROME_BROWSER_BROWSER_URL_HANDLER_H_
13 #define CHROME_BROWSER_BROWSER_URL_HANDLER_H_ 13 #define CHROME_BROWSER_BROWSER_URL_HANDLER_H_
14 14
15 #include <vector> 15 #include <vector>
16 16
17 class GURL; 17 class GURL;
18 class Profile;
18 19
19 // BrowserURLHandler manages the list of all special URLs and manages 20 // BrowserURLHandler manages the list of all special URLs and manages
20 // dispatching the URL handling to registered handlers. 21 // dispatching the URL handling to registered handlers.
21 class BrowserURLHandler { 22 class BrowserURLHandler {
22 public: 23 public:
23 // The type of functions that can process a URL. 24 // The type of functions that can process a URL.
24 // If a handler handles |url|, it should : 25 // If a handler handles |url|, it should :
25 // - optionally modify |url| to the URL that should be sent to the renderer 26 // - optionally modify |url| to the URL that should be sent to the renderer
26 // - optionally set |dispatcher| to the necessary DOMMessageDispatcher 27 // - optionally set |dispatcher| to the necessary DOMMessageDispatcher
27 // - return true. 28 // - return true.
28 // If the URL is not handled by a handler, it should return false. 29 // If the URL is not handled by a handler, it should return false.
29 typedef bool (*URLHandler)(GURL* url); 30 typedef bool (*URLHandler)(GURL* url, Profile* profile);
30 31
31 // HandleBrowserURL gives all registered URLHandlers a shot at processing 32 // HandleBrowserURL gives all registered URLHandlers a shot at processing
32 // the given URL, and modifies it in place. 33 // the given URL, and modifies it in place.
33 static void RewriteURLIfNecessary(GURL* url); 34 static void RewriteURLIfNecessary(GURL* url, Profile* profile);
34 35
35 // We initialize the list of url_handlers_ lazily the first time MaybeHandle 36 // We initialize the list of url_handlers_ lazily the first time MaybeHandle
36 // is called. 37 // is called.
37 static void InitURLHandlers(); 38 static void InitURLHandlers();
38 39
39 // The list of known URLHandlers. 40 // The list of known URLHandlers.
40 static std::vector<URLHandler> url_handlers_; 41 static std::vector<URLHandler> url_handlers_;
41 }; 42 };
42 43
43 #endif // CHROME_BROWSER_BROWSER_URL_HANDLER_H_ 44 #endif // CHROME_BROWSER_BROWSER_URL_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_prefs.cc ('k') | chrome/browser/browser_url_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698