summaryrefslogtreecommitdiffstats
path: root/chrome/common/about_handler.cc
blob: 6e3e152529af46f39bd9ccbd70ec57c2b87c7b0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.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::kAboutKillURL,
  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