OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/net/url_fixer_upper.h" | 15 #include "chrome/browser/net/url_fixer_upper.h" |
15 #include "chrome/browser/ui/browser_dialogs.h" | 16 #include "chrome/browser/ui/browser_dialogs.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // Add paths here to be included in chrome://chrome-urls (about:about). | 22 // Add paths here to be included in chrome://chrome-urls (about:about). |
22 // These paths will also be suggested by BuiltinProvider. | 23 // These paths will also be suggested by BuiltinProvider. |
23 const char* const kPaths[] = { | 24 const char* const kPaths[] = { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 path = chrome::kChromeUIHistoryHost + url->path(); | 150 path = chrome::kChromeUIHistoryHost + url->path(); |
150 #endif | 151 #endif |
151 // Redirect chrome://settings | 152 // Redirect chrome://settings |
152 } else if (host == chrome::kChromeUISettingsHost) { | 153 } else if (host == chrome::kChromeUISettingsHost) { |
153 host = chrome::kChromeUIUberHost; | 154 host = chrome::kChromeUIUberHost; |
154 path = chrome::kChromeUISettingsHost + url->path(); | 155 path = chrome::kChromeUISettingsHost + url->path(); |
155 // Redirect chrome://help | 156 // Redirect chrome://help |
156 } else if (host == chrome::kChromeUIHelpHost) { | 157 } else if (host == chrome::kChromeUIHelpHost) { |
157 host = chrome::kChromeUIUberHost; | 158 host = chrome::kChromeUIUberHost; |
158 path = chrome::kChromeUIHelpHost + url->path(); | 159 path = chrome::kChromeUIHelpHost + url->path(); |
| 160 } else if (host == chrome::kChromeUIRestartHost) { |
| 161 chrome::AttemptRestart(); |
159 } | 162 } |
160 GURL::Replacements replacements; | 163 GURL::Replacements replacements; |
161 replacements.SetHostStr(host); | 164 replacements.SetHostStr(host); |
162 if (!path.empty()) | 165 if (!path.empty()) |
163 replacements.SetPathStr(path); | 166 replacements.SetPathStr(path); |
164 *url = url->ReplaceComponents(replacements); | 167 *url = url->ReplaceComponents(replacements); |
165 | 168 |
166 // Having re-written the URL, make the chrome: handler process it. | 169 // Having re-written the URL, make the chrome: handler process it. |
167 return false; | 170 return false; |
168 } | 171 } |
(...skipping 15 matching lines...) Expand all Loading... |
184 #endif // OFFICIAL_BUILD | 187 #endif // OFFICIAL_BUILD |
185 | 188 |
186 return false; | 189 return false; |
187 } | 190 } |
188 | 191 |
189 std::vector<std::string> ChromePaths() { | 192 std::vector<std::string> ChromePaths() { |
190 std::vector<std::string> paths(kPaths, kPaths + arraysize(kPaths)); | 193 std::vector<std::string> paths(kPaths, kPaths + arraysize(kPaths)); |
191 std::sort(paths.begin(), paths.end()); | 194 std::sort(paths.begin(), paths.end()); |
192 return paths; | 195 return paths; |
193 } | 196 } |
OLD | NEW |