Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: chrome/renderer/about_handler.cc

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup and improve patch. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/about_handler.h" 5 #include "chrome/renderer/about_handler.h"
6 6
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "chrome/common/about_handler.h" 9 #include "chrome/common/about_handler.h"
10 #include "content/common/url_constants.h"
10 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
11 12
12 typedef void (*AboutHandlerFuncPtr)(); 13 typedef void (*AboutHandlerFuncPtr)();
13 14
14 // This needs to match up with chrome_about_handler::about_urls in 15 // This needs to match up with chrome_about_handler::about_urls in
15 // chrome/common/about_handler.cc. 16 // chrome/common/about_handler.cc.
16 static const AboutHandlerFuncPtr about_urls_handlers[] = { 17 static const AboutHandlerFuncPtr about_urls_handlers[] = {
17 AboutHandler::AboutCrash, 18 AboutHandler::AboutCrash,
18 AboutHandler::AboutKill, 19 AboutHandler::AboutKill,
19 AboutHandler::AboutHang, 20 AboutHandler::AboutHang,
20 AboutHandler::AboutShortHang, 21 AboutHandler::AboutShortHang,
21 NULL, 22 NULL,
22 }; 23 };
23 24
24 // static 25 // static
25 bool AboutHandler::MaybeHandle(const GURL& url) { 26 bool AboutHandler::MaybeHandle(const GURL& url) {
26 if (url.scheme() != chrome_about_handler::kAboutScheme) 27 if (!url.SchemeIs(chrome::kAboutScheme))
27 return false; 28 return false;
28 29
29 int about_urls_handler_index = 0; 30 int about_urls_handler_index = 0;
30 const char* const* url_handler = chrome_about_handler::about_urls; 31 const char* const* url_handler = chrome_about_handler::about_urls;
31 while (*url_handler) { 32 while (*url_handler) {
32 if (GURL(*url_handler) == url) { 33 if (GURL(*url_handler) == url) {
33 about_urls_handlers[about_urls_handler_index](); 34 about_urls_handlers[about_urls_handler_index]();
34 return true; // theoretically :] 35 return true; // theoretically :]
35 } 36 }
36 url_handler++; 37 url_handler++;
(...skipping 22 matching lines...) Expand all
59 60
60 // static 61 // static
61 void AboutHandler::AboutShortHang() { 62 void AboutHandler::AboutShortHang() {
62 base::PlatformThread::Sleep(20000); 63 base::PlatformThread::Sleep(20000);
63 } 64 }
64 65
65 // static 66 // static
66 size_t AboutHandler::AboutURLHandlerSize() { 67 size_t AboutHandler::AboutURLHandlerSize() {
67 return arraysize(about_urls_handlers); 68 return arraysize(about_urls_handlers);
68 } 69 }
OLDNEW
« chrome/browser/ui/webui/web_ui_util.cc ('K') | « chrome/common/url_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698