| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/about_handler.h" | 5 #include "chrome/common/about_handler.h" |
| 6 #include "chrome/common/url_constants.h" | 6 #include "chrome/common/url_constants.h" |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 | 8 |
| 9 namespace chrome_about_handler { | 9 namespace chrome_about_handler { |
| 10 | 10 |
| 11 // This needs to match up with about_urls_handlers in | 11 // This needs to match up with about_urls_handlers in |
| 12 // chrome/renderer/about_handler.cc. | 12 // chrome/renderer/about_handler.cc. |
| 13 const char* const about_urls[] = { | 13 const char* const about_urls[] = { |
| 14 chrome::kAboutCrashURL, | 14 chrome::kAboutCrashURL, |
| 15 chrome::kAboutKillURL, |
| 15 chrome::kAboutHangURL, | 16 chrome::kAboutHangURL, |
| 16 chrome::kAboutShorthangURL, | 17 chrome::kAboutShorthangURL, |
| 17 NULL, | 18 NULL, |
| 18 }; | 19 }; |
| 19 const size_t about_urls_size = arraysize(about_urls); | 20 const size_t about_urls_size = arraysize(about_urls); |
| 20 | 21 |
| 21 const char* const kAboutScheme = "about"; | 22 const char* const kAboutScheme = "about"; |
| 22 | 23 |
| 23 bool WillHandle(const GURL& url) { | 24 bool WillHandle(const GURL& url) { |
| 24 if (url.scheme() != kAboutScheme) | 25 if (url.scheme() != kAboutScheme) |
| 25 return false; | 26 return false; |
| 26 | 27 |
| 27 const char* const* url_handler = about_urls; | 28 const char* const* url_handler = about_urls; |
| 28 while (*url_handler) { | 29 while (*url_handler) { |
| 29 if (GURL(*url_handler) == url) | 30 if (GURL(*url_handler) == url) |
| 30 return true; | 31 return true; |
| 31 url_handler++; | 32 url_handler++; |
| 32 } | 33 } |
| 33 return false; | 34 return false; |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace chrome_about_handler | 37 } // namespace chrome_about_handler |
| OLD | NEW |