| 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/string_util.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 // Decides whether 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 // and returns true if so. On true, it may also modify the given URL to be the |
| 24 // final form (we fix up most "about:" URLs to be "chrome:" because WebKit | 24 // final form (we fix up most "about:" URLs to be "chrome:" because WebKit |
| 25 // handles all "about:" URLs as "about:blank. | 25 // handles all "about:" URLs as "about:blank. |
| 26 // | 26 // |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 | 53 |
| 54 // Records the output for a specified header string. | 54 // Records the output for a specified header string. |
| 55 void SetOutput(const std::string& header, const std::string& output) { | 55 void SetOutput(const std::string& header, const std::string& output) { |
| 56 outputs_[header] = output; | 56 outputs_[header] = output; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Callback for output returned from renderer processes. Adds | 59 // Callback for output returned from renderer processes. Adds |
| 60 // the output for a canonical renderer header string that | 60 // the output for a canonical renderer header string that |
| 61 // incorporates the pid. | 61 // incorporates the pid. |
| 62 void RendererCallback(base::ProcessId pid, const std::string& output) { | 62 void RendererCallback(base::ProcessId pid, const std::string& output) { |
| 63 SetOutput(StringPrintf("Renderer PID %d", static_cast<int>(pid)), output); | 63 SetOutput( |
| 64 base::StringPrintf("Renderer PID %d", static_cast<int>(pid)), output); |
| 64 } | 65 } |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 AboutTcmallocOutputs(); | 68 AboutTcmallocOutputs(); |
| 68 ~AboutTcmallocOutputs(); | 69 ~AboutTcmallocOutputs(); |
| 69 | 70 |
| 70 AboutTcmallocOutputsType outputs_; | 71 AboutTcmallocOutputsType outputs_; |
| 71 | 72 |
| 72 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>; | 73 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); | 75 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 // Glue between the callback task and the method in the singleton. | 78 // Glue between the callback task and the method in the singleton. |
| 78 void AboutTcmallocRendererCallback(base::ProcessId pid, | 79 void AboutTcmallocRendererCallback(base::ProcessId pid, |
| 79 const std::string& output); | 80 const std::string& output); |
| 80 #endif | 81 #endif |
| 81 | 82 |
| 82 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ | 83 #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ |
| OLD | NEW |