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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 5315006: chromeos: Fix DOMUI about:credits link. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: abstract out AboutSource init code from WillHandleBrowserAboutURL Created 9 years, 11 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) 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/browser/browser_about_handler.h" 5 #include "chrome/browser/browser_about_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutGpuHangURL)) { 1071 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutGpuHangURL)) {
1072 GpuProcessHostUIShim::GetInstance()->SendAboutGpuHang(); 1072 GpuProcessHostUIShim::GetInstance()->SendAboutGpuHang();
1073 return true; 1073 return true;
1074 } 1074 }
1075 1075
1076 // There are a few about: URLs that we hand over to the renderer. If the 1076 // There are a few about: URLs that we hand over to the renderer. If the
1077 // renderer wants them, don't do any rewriting. 1077 // renderer wants them, don't do any rewriting.
1078 if (chrome_about_handler::WillHandle(*url)) 1078 if (chrome_about_handler::WillHandle(*url))
1079 return false; 1079 return false;
1080 1080
1081 // Anything else requires our special handler, make sure its initialized. 1081 // Anything else requires our special handler; make sure it's initialized.
1082 // We only need to register the AboutSource once and it is kept globally. 1082 InitializeAboutDataSource();
1083 // There is currently no way to remove a data source.
1084 static bool initialized = false;
1085 if (!initialized) {
1086 about_source = new AboutSource();
1087 initialized = true;
1088 }
1089 1083
1090 // Special case about:memory to go through a redirect before ending up on 1084 // Special case about:memory to go through a redirect before ending up on
1091 // the final page. See GetAboutMemoryRedirectResponse above for why. 1085 // the final page. See GetAboutMemoryRedirectResponse above for why.
1092 if (LowerCaseEqualsASCII(url->path(), kMemoryPath)) { 1086 if (LowerCaseEqualsASCII(url->path(), kMemoryPath)) {
1093 *url = GURL("chrome://about/memory-redirect"); 1087 *url = GURL("chrome://about/memory-redirect");
1094 return true; 1088 return true;
1095 } 1089 }
1096 1090
1097 // Rewrite the about URL to use chrome:. WebKit treats all about URLS the 1091 // Rewrite the about URL to use chrome:. WebKit treats all about URLS the
1098 // same (blank page), so if we want to display content, we need another 1092 // same (blank page), so if we want to display content, we need another
1099 // scheme. 1093 // scheme.
1100 std::string about_url = "chrome://about/"; 1094 std::string about_url = "chrome://about/";
1101 about_url.append(url->path()); 1095 about_url.append(url->path());
1102 *url = GURL(about_url); 1096 *url = GURL(about_url);
1103 return true; 1097 return true;
1104 } 1098 }
1105 1099
1100 void InitializeAboutDataSource() {
1101 // We only need to register the AboutSource once and it is kept globally.
1102 // There is currently no way to remove a data source.
1103 static bool initialized = false;
1104 if (!initialized) {
1105 about_source = new AboutSource();
1106 initialized = true;
1107 }
1108 }
1109
1106 // This function gets called with the fixed-up chrome: URLs, so we have to 1110 // This function gets called with the fixed-up chrome: URLs, so we have to
1107 // compare against those instead of "about:blah". 1111 // compare against those instead of "about:blah".
1108 bool HandleNonNavigationAboutURL(const GURL& url) { 1112 bool HandleNonNavigationAboutURL(const GURL& url) {
1109 // about:ipc is currently buggy, so we disable it for official builds. 1113 // about:ipc is currently buggy, so we disable it for official builds.
1110 #if !defined(OFFICIAL_BUILD) 1114 #if !defined(OFFICIAL_BUILD)
1111 1115
1112 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) 1116 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED)
1113 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { 1117 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) {
1114 // Run the dialog. This will re-use the existing one if it's already up. 1118 // Run the dialog. This will re-use the existing one if it's already up.
1115 AboutIPCDialog::RunDialog(); 1119 AboutIPCDialog::RunDialog();
1116 return true; 1120 return true;
1117 } 1121 }
1118 #endif 1122 #endif
1119 1123
1120 #endif // OFFICIAL_BUILD 1124 #endif // OFFICIAL_BUILD
1121 1125
1122 return false; 1126 return false;
1123 } 1127 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.h ('k') | chrome/browser/dom_ui/options/about_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698