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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 replacements.SetHostStr(host); | 82 replacements.SetHostStr(host); |
83 if (!path.empty()) | 83 if (!path.empty()) |
84 replacements.SetPathStr(path); | 84 replacements.SetPathStr(path); |
85 *url = url->ReplaceComponents(replacements); | 85 *url = url->ReplaceComponents(replacements); |
86 | 86 |
87 // Having re-written the URL, make the chrome: handler process it. | 87 // Having re-written the URL, make the chrome: handler process it. |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 bool HandleNonNavigationAboutURL(const GURL& url) { | 91 bool HandleNonNavigationAboutURL(const GURL& url) { |
92 const std::string host(url.host()); | 92 const std::string spec(url.spec()); |
93 | 93 |
94 if (host == chrome::kChromeUIRestartHost) { | 94 if (LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { |
95 // Call AttemptRestart after chrome::Navigate() completes to avoid access of | 95 // Call AttemptRestart after chrome::Navigate() completes to avoid access of |
96 // gtk objects after they are destroyed by BrowserWindowGtk::Close(). | 96 // gtk objects after they are destroyed by BrowserWindowGtk::Close(). |
97 base::MessageLoop::current()->PostTask(FROM_HERE, | 97 base::MessageLoop::current()->PostTask(FROM_HERE, |
98 base::Bind(&chrome::AttemptRestart)); | 98 base::Bind(&chrome::AttemptRestart)); |
99 return true; | 99 return true; |
100 } else if (host == chrome::kChromeUIQuitHost) { | 100 } else if (LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
101 base::MessageLoop::current()->PostTask(FROM_HERE, | 101 base::MessageLoop::current()->PostTask(FROM_HERE, |
102 base::Bind(&chrome::AttemptExit)); | 102 base::Bind(&chrome::AttemptExit)); |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 // chrome://ipc/ is currently buggy, so we disable it for official builds. | 106 // chrome://ipc/ is currently buggy, so we disable it for official builds. |
107 #if !defined(OFFICIAL_BUILD) | 107 #if !defined(OFFICIAL_BUILD) |
108 | 108 |
109 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) | 109 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) |
110 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { | 110 if (LowerCaseEqualsASCII(spec, chrome::kChromeUIIPCURL)) { |
111 // Run the dialog. This will re-use the existing one if it's already up. | 111 // Run the dialog. This will re-use the existing one if it's already up. |
112 chrome::ShowAboutIPCDialog(); | 112 chrome::ShowAboutIPCDialog(); |
113 return true; | 113 return true; |
114 } | 114 } |
115 #endif | 115 #endif |
116 | 116 |
117 #endif // OFFICIAL_BUILD | 117 #endif // OFFICIAL_BUILD |
118 | 118 |
119 return false; | 119 return false; |
120 } | 120 } |
OLD | NEW |