OLD | NEW |
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 // Contains code for handling "about:" URLs in the browser process. | 5 // Contains code for handling "about:" URLs in the browser process. |
6 | 6 |
7 #ifndef CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 7 #ifndef CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
8 #define CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 8 #define CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
9 | 9 |
10 #include <string> | 10 #include "chrome/browser/tab_contents/tab_contents_type.h" |
11 | 11 |
12 #include "base/basictypes.h" | 12 class GURL; |
13 #include "chrome/browser/tab_contents/tab_contents_type.h" | |
14 #include "chrome/browser/tab_contents/web_contents.h" | |
15 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | |
16 | 13 |
17 class AboutSource; | 14 // Decides whether the given URL will be handled by the browser about handler |
18 class DictionaryValue; | 15 // and returns true if so. On true, it may also modify the given URL to be the |
19 class GURL; | 16 // final form (we fix up most "about:" URLs to be "chrome-ui:" because WebKit |
20 class ListValue; | 17 // handles all "about:" URLs as "about:blank. |
21 class Profile; | 18 // |
22 class RenderProcessHost; | 19 // This is used by BrowserURLHandler. |
23 class RenderViewHostFactory; | 20 bool WillHandleBrowserAboutURL(GURL* url, TabContentsType* type); |
24 class SiteInstance; | |
25 | 21 |
26 class BrowserAboutHandler : public WebContents { | 22 // We have a few magic commands that don't cause navigations, but rather pop up |
27 public: | 23 // dialogs. This function handles those cases, and returns true if so. In this |
28 BrowserAboutHandler(Profile* profile, | 24 // case, normal tab navigation should be skipped. |
29 SiteInstance* instance, | 25 bool HandleNonNavigationAboutURL(const GURL& url); |
30 RenderViewHostFactory* render_view_factory); | |
31 virtual ~BrowserAboutHandler() {} | |
32 | |
33 // We don't want a favicon on the about pages. | |
34 virtual bool ShouldDisplayFavIcon() { return false; } | |
35 // Enable javascript urls for the about pages. | |
36 virtual bool SupportsURL(GURL* url); | |
37 | |
38 // If |url| is a known "about:" URL, this method handles it | |
39 // and sets |url| to an alternate URL indicating the real content to load. | |
40 // (If it's not a URL that the function can handle, it's a no-op and returns | |
41 // false.) | |
42 static bool MaybeHandle(GURL* url, TabContentsType* type); | |
43 | |
44 // Renders a special page for "about:" which displays version information. | |
45 static std::string AboutVersion(); | |
46 | |
47 // Renders a special page for about:plugins. | |
48 static std::string AboutPlugins(); | |
49 | |
50 // Renders a special page for about:histograms. | |
51 static std::string AboutHistograms(const std::string& query); | |
52 | |
53 // Renders a special page about:objects (about tracked objects such as Tasks). | |
54 static std::string AboutObjects(const std::string& query); | |
55 | |
56 // Renders a special page for about:dns. | |
57 static std::string AboutDns(); | |
58 | |
59 // Renders a special page for about:stats. | |
60 static std::string AboutStats(); | |
61 | |
62 // Renders a special page for "about:credits" which displays our | |
63 // acknowledgements and legal information for code we depend on. | |
64 static std::string AboutCredits(); | |
65 | |
66 // Renders a special page for "about:terms" which displays our | |
67 // terms and conditions. | |
68 static std::string AboutTerms(); | |
69 | |
70 // Renders a special page for about:memory which displays | |
71 // information about current state. | |
72 static void AboutMemory(AboutSource*, int request_id); | |
73 | |
74 // This displays the Linux splash screen for development releases. | |
75 static std::string AboutLinuxSplash(); | |
76 | |
77 private: | |
78 ChromeURLDataManager::DataSource* about_source_; | |
79 DISALLOW_COPY_AND_ASSIGN(BrowserAboutHandler); | |
80 }; | |
81 | 26 |
82 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 27 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
OLD | NEW |