| 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. | |
| 6 | |
| 7 #ifndef CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
| 8 #define CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 6 #define CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
| 9 #pragma once | 7 #pragma once |
| 10 | 8 |
| 11 #include <map> | 9 #include <map> |
| 12 #include <string> | 10 #include <string> |
| 13 #include <vector> | 11 #include <vector> |
| 14 | 12 |
| 15 #include "base/process.h" | 13 #include "base/process.h" |
| 16 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 17 #include "build/build_config.h" // USE_TCMALLOC | 15 #include "build/build_config.h" // USE_TCMALLOC |
| 18 | 16 |
| 19 template <typename T> struct DefaultSingletonTraits; | 17 template <typename T> struct DefaultSingletonTraits; |
| 20 class GURL; | 18 class GURL; |
| 21 | 19 |
| 22 namespace content { | 20 namespace content { |
| 23 class BrowserContext; | 21 class BrowserContext; |
| 24 } | 22 } |
| 25 | 23 |
| 26 // Register a data source for a known source name. Safe to call multiple times. | |
| 27 // |name| may be an unkown host (e.g. "chrome://foo/"); only handle known hosts. | |
| 28 // In general case WillHandleBrowserAboutURL will initialize all data sources. | |
| 29 // But in some case like navigating to chrome://oobe on boot and loading | |
| 30 // chrome://terms in an iframe there, kChromeUITermsHost data source needs to | |
| 31 // be initialized separately. | |
| 32 void InitializeAboutDataSource(const std::string& name, | |
| 33 content::BrowserContext* browser_context); | |
| 34 | |
| 35 // Returns true if the given URL will be handled by the browser about handler. | 24 // Returns true if the given URL will be handled by the browser about handler. |
| 36 // |url| should have been processed by URLFixerUpper::FixupURL, which replaces | 25 // Nowadays, these go through the webui, so the return is always false. |
| 37 // the about: scheme with chrome:// for all about:foo URLs except "about:blank". | 26 // Either way, |url| will be processed by URLFixerUpper::FixupURL, which |
| 27 // replaces the about: scheme with chrome:// for all about:foo URLs except |
| 28 // "about:blank". |
| 38 // Some |url| host values will be replaced with their respective redirects. | 29 // Some |url| host values will be replaced with their respective redirects. |
| 39 // | 30 // |
| 40 // This is used by BrowserURLHandler. | 31 // This is used by BrowserURLHandler. |
| 41 bool WillHandleBrowserAboutURL(GURL* url, | 32 bool WillHandleBrowserAboutURL(GURL* url, |
| 42 content::BrowserContext* browser_context); | 33 content::BrowserContext* browser_context); |
| 43 | 34 |
| 44 // We have a few magic commands that don't cause navigations, but rather pop up | 35 // We have a few magic commands that don't cause navigations, but rather pop up |
| 45 // dialogs. This function handles those cases, and returns true if so. In this | 36 // dialogs. This function handles those cases, and returns true if so. In this |
| 46 // case, normal tab navigation should be skipped. | 37 // case, normal tab navigation should be skipped. |
| 47 bool HandleNonNavigationAboutURL(const GURL& url); | 38 bool HandleNonNavigationAboutURL(const GURL& url); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 AboutTcmallocOutputsType outputs_; | 72 AboutTcmallocOutputsType outputs_; |
| 82 | 73 |
| 83 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>; | 74 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>; |
| 84 | 75 |
| 85 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); | 76 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); |
| 86 }; | 77 }; |
| 87 | 78 |
| 88 // Glue between the callback task and the method in the singleton. | 79 // Glue between the callback task and the method in the singleton. |
| 89 void AboutTcmallocRendererCallback(base::ProcessId pid, | 80 void AboutTcmallocRendererCallback(base::ProcessId pid, |
| 90 const std::string& output); | 81 const std::string& output); |
| 91 #endif | 82 #endif // defined(USE_TCMALLOC) |
| 92 | 83 |
| 93 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 84 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
| OLD | NEW |