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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 path = chrome::kChromeUISettingsHost + url->path(); | 63 path = chrome::kChromeUISettingsHost + url->path(); |
64 // Redirect chrome://help | 64 // Redirect chrome://help |
65 } else if (host == chrome::kChromeUIHelpHost) { | 65 } else if (host == chrome::kChromeUIHelpHost) { |
66 host = chrome::kChromeUIUberHost; | 66 host = chrome::kChromeUIUberHost; |
67 path = chrome::kChromeUIHelpHost + url->path(); | 67 path = chrome::kChromeUIHelpHost + url->path(); |
68 } else if (host == chrome::kChromeUIRestartHost) { | 68 } else if (host == chrome::kChromeUIRestartHost) { |
69 // Call AttemptRestart after chrome::Navigate() completes to avoid access of | 69 // Call AttemptRestart after chrome::Navigate() completes to avoid access of |
70 // gtk objects after they are destoyed by BrowserWindowGtk::Close(). | 70 // gtk objects after they are destoyed by BrowserWindowGtk::Close(). |
71 base::MessageLoop::current()->PostTask(FROM_HERE, | 71 base::MessageLoop::current()->PostTask(FROM_HERE, |
72 base::Bind(&chrome::AttemptRestart)); | 72 base::Bind(&chrome::AttemptRestart)); |
| 73 } else if (host == chrome::kChromeUIQuitHost) { |
| 74 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 75 base::Bind(&chrome::AttemptExit)); |
73 } | 76 } |
74 | 77 |
75 GURL::Replacements replacements; | 78 GURL::Replacements replacements; |
76 replacements.SetHostStr(host); | 79 replacements.SetHostStr(host); |
77 if (!path.empty()) | 80 if (!path.empty()) |
78 replacements.SetPathStr(path); | 81 replacements.SetPathStr(path); |
79 *url = url->ReplaceComponents(replacements); | 82 *url = url->ReplaceComponents(replacements); |
80 | 83 |
81 // Having re-written the URL, make the chrome: handler process it. | 84 // Having re-written the URL, make the chrome: handler process it. |
82 return false; | 85 return false; |
83 } | 86 } |
84 | 87 |
85 bool HandleNonNavigationAboutURL(const GURL& url) { | 88 bool HandleNonNavigationAboutURL(const GURL& url) { |
86 // chrome://ipc/ is currently buggy, so we disable it for official builds. | 89 // chrome://ipc/ is currently buggy, so we disable it for official builds. |
87 #if !defined(OFFICIAL_BUILD) | 90 #if !defined(OFFICIAL_BUILD) |
88 | 91 |
89 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) | 92 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) |
90 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { | 93 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { |
91 // Run the dialog. This will re-use the existing one if it's already up. | 94 // Run the dialog. This will re-use the existing one if it's already up. |
92 chrome::ShowAboutIPCDialog(); | 95 chrome::ShowAboutIPCDialog(); |
93 return true; | 96 return true; |
94 } | 97 } |
95 #endif | 98 #endif |
96 | 99 |
97 #endif // OFFICIAL_BUILD | 100 #endif // OFFICIAL_BUILD |
98 | 101 |
99 return false; | 102 return false; |
100 } | 103 } |
OLD | NEW |