summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 04:09:14 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 04:09:14 +0000
commit3e0f7d520ae052fa4f092d75e61ca3605109f44f (patch)
tree8272de51d40a9f8ca4e6d3ab94e34fa20693669e /chrome/common
parent5ed60cdb3f706f8e033d67d5f4e3b4663fa7630d (diff)
downloadchromium_src-3e0f7d520ae052fa4f092d75e61ca3605109f44f.zip
chromium_src-3e0f7d520ae052fa4f092d75e61ca3605109f44f.tar.gz
chromium_src-3e0f7d520ae052fa4f092d75e61ca3605109f44f.tar.bz2
Split part of about_handler into chrome/common to break the browser-renderer dependency.
BUG=46666 TEST=none Review URL: http://codereview.chromium.org/2814012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50209 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/about_handler.cc34
-rw-r--r--chrome/common/about_handler.h23
2 files changed, 57 insertions, 0 deletions
diff --git a/chrome/common/about_handler.cc b/chrome/common/about_handler.cc
new file mode 100644
index 0000000..84658a0
--- /dev/null
+++ b/chrome/common/about_handler.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/about_handler.h"
+
+namespace chrome_about_handler {
+
+// This needs to match up with about_urls_handlers in
+// chrome/renderer/about_handler.cc.
+const char* const about_urls[] = {
+ chrome::kAboutCrashURL,
+ chrome::kAboutHangURL,
+ chrome::kAboutShorthangURL,
+ NULL,
+};
+const size_t about_urls_size = arraysize(about_urls);
+
+const char* const kAboutScheme = "about";
+
+bool WillHandle(const GURL& url) {
+ if (url.scheme() != kAboutScheme)
+ return false;
+
+ const char* const* url_handler = about_urls;
+ while (*url_handler) {
+ if (GURL(*url_handler) == url)
+ return true;
+ url_handler++;
+ }
+ return false;
+}
+
+} // namespace chrome_about_handler
diff --git a/chrome/common/about_handler.h b/chrome/common/about_handler.h
new file mode 100644
index 0000000..f5d0818
--- /dev/null
+++ b/chrome/common/about_handler.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_ABOUT_HANDLER_H__
+#define CHROME_COMMON_ABOUT_HANDLER_H__
+
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
+
+namespace chrome_about_handler {
+
+extern const char* const about_urls[];
+extern const size_t about_urls_size; // Only used for testing
+extern const char* const kAboutScheme;
+
+// Returns true if the URL is one that AboutHandler will handle when
+// AboutHandler::MaybeHandle is called.
+bool WillHandle(const GURL& url);
+
+} // namespace chrome_about_handler
+
+#endif // CHROME_COMMON_ABOUT_HANDLER_H__