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