OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 | 17 |
18 template <typename T> struct DefaultSingletonTraits; | 18 template <typename T> struct DefaultSingletonTraits; |
19 class GURL; | 19 class GURL; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 // Decides whether the given URL will be handled by the browser about handler | 22 // Returns true if the given URL will be handled by the browser about handler. |
23 // and returns true if so. On true, it may also modify the given URL to be the | 23 // |url| should have been processed by URLFixerUpper::FixupURL, which replaces |
24 // final form (we fix up most "about:" URLs to be "chrome:" because WebKit | 24 // the about: scheme with chrome:// for all about:foo URLs except "about:blank". |
25 // handles all "about:" URLs as "about:blank. | 25 // Some |url| host values will be replaced with their respective redirects. |
26 // | 26 // |
27 // This is used by BrowserURLHandler. | 27 // This is used by BrowserURLHandler. |
28 bool WillHandleBrowserAboutURL(GURL* url, Profile* profile); | 28 bool WillHandleBrowserAboutURL(GURL* url, Profile* profile); |
29 | 29 |
30 // Register the data source for chrome://about URLs. | |
31 // Safe to call multiple times. | |
32 void InitializeAboutDataSource(Profile* profile); | |
33 | |
34 // We have a few magic commands that don't cause navigations, but rather pop up | 30 // We have a few magic commands that don't cause navigations, but rather pop up |
35 // dialogs. This function handles those cases, and returns true if so. In this | 31 // dialogs. This function handles those cases, and returns true if so. In this |
36 // case, normal tab navigation should be skipped. | 32 // case, normal tab navigation should be skipped. |
37 bool HandleNonNavigationAboutURL(const GURL& url); | 33 bool HandleNonNavigationAboutURL(const GURL& url); |
38 | 34 |
39 // Gets the paths that are shown in about:about. | 35 // Gets the paths that are shown in chrome://chrome-urls. |
40 std::vector<std::string> AboutPaths(); | 36 std::vector<std::string> ChromePaths(); |
41 | 37 |
42 #if defined(USE_TCMALLOC) | 38 #if defined(USE_TCMALLOC) |
43 // A map of header strings (e.g. "Browser", "Renderer PID 123") | 39 // A map of header strings (e.g. "Browser", "Renderer PID 123") |
44 // to the tcmalloc output collected for each process. | 40 // to the tcmalloc output collected for each process. |
45 typedef std::map<std::string, std::string> AboutTcmallocOutputsType; | 41 typedef std::map<std::string, std::string> AboutTcmallocOutputsType; |
46 | 42 |
47 class AboutTcmallocOutputs { | 43 class AboutTcmallocOutputs { |
48 public: | 44 public: |
49 // Returns the singleton instance. | 45 // Returns the singleton instance. |
50 static AboutTcmallocOutputs* GetInstance(); | 46 static AboutTcmallocOutputs* GetInstance(); |
(...skipping 23 matching lines...) Expand all Loading... |
74 | 70 |
75 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); | 71 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); |
76 }; | 72 }; |
77 | 73 |
78 // Glue between the callback task and the method in the singleton. | 74 // Glue between the callback task and the method in the singleton. |
79 void AboutTcmallocRendererCallback(base::ProcessId pid, | 75 void AboutTcmallocRendererCallback(base::ProcessId pid, |
80 const std::string& output); | 76 const std::string& output); |
81 #endif | 77 #endif |
82 | 78 |
83 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 79 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
OLD | NEW |