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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 path = chrome::kChromeUIHistoryHost + url->path(); | 154 path = chrome::kChromeUIHistoryHost + url->path(); |
154 #endif | 155 #endif |
155 // Redirect chrome://settings | 156 // Redirect chrome://settings |
156 } else if (host == chrome::kChromeUISettingsHost) { | 157 } else if (host == chrome::kChromeUISettingsHost) { |
157 host = chrome::kChromeUIUberHost; | 158 host = chrome::kChromeUIUberHost; |
158 path = chrome::kChromeUISettingsHost + url->path(); | 159 path = chrome::kChromeUISettingsHost + url->path(); |
159 // Redirect chrome://help | 160 // Redirect chrome://help |
160 } else if (host == chrome::kChromeUIHelpHost) { | 161 } else if (host == chrome::kChromeUIHelpHost) { |
161 host = chrome::kChromeUIUberHost; | 162 host = chrome::kChromeUIUberHost; |
162 path = chrome::kChromeUIHelpHost + url->path(); | 163 path = chrome::kChromeUIHelpHost + url->path(); |
| 164 } else if (host == chrome::kChromeUIRestartHost) { |
| 165 // Call AttemptRestart after chrome::Navigate() completes to avoid access of |
| 166 // gtk objects after they are destoyed by BrowserWindowGtk::Close(). |
| 167 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 168 base::Bind(&chrome::AttemptRestart)); |
163 } | 169 } |
164 GURL::Replacements replacements; | 170 GURL::Replacements replacements; |
165 replacements.SetHostStr(host); | 171 replacements.SetHostStr(host); |
166 if (!path.empty()) | 172 if (!path.empty()) |
167 replacements.SetPathStr(path); | 173 replacements.SetPathStr(path); |
168 *url = url->ReplaceComponents(replacements); | 174 *url = url->ReplaceComponents(replacements); |
169 | 175 |
170 // Having re-written the URL, make the chrome: handler process it. | 176 // Having re-written the URL, make the chrome: handler process it. |
171 return false; | 177 return false; |
172 } | 178 } |
(...skipping 15 matching lines...) Expand all Loading... |
188 #endif // OFFICIAL_BUILD | 194 #endif // OFFICIAL_BUILD |
189 | 195 |
190 return false; | 196 return false; |
191 } | 197 } |
192 | 198 |
193 std::vector<std::string> ChromePaths() { | 199 std::vector<std::string> ChromePaths() { |
194 std::vector<std::string> paths(kPaths, kPaths + arraysize(kPaths)); | 200 std::vector<std::string> paths(kPaths, kPaths + arraysize(kPaths)); |
195 std::sort(paths.begin(), paths.end()); | 201 std::sort(paths.begin(), paths.end()); |
196 return paths; | 202 return paths; |
197 } | 203 } |
OLD | NEW |