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

Unified Diff: chrome/browser/dom_ui/chrome_url_data_manager.cc

Issue 155067: Hookup Print HTML page to the DOM UI for Print Preview and Settings... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/child_process_security_policy.cc ('k') | chrome/browser/dom_ui/dom_ui_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/chrome_url_data_manager.cc
===================================================================
--- chrome/browser/dom_ui/chrome_url_data_manager.cc (revision 20594)
+++ chrome/browser/dom_ui/chrome_url_data_manager.cc (working copy)
@@ -116,6 +116,8 @@
URLRequest::RegisterProtocolFactory(kChromeURLScheme,
&ChromeURLDataManager::Factory);
+ URLRequest::RegisterProtocolFactory(chrome::kPrintScheme,
+ &ChromeURLDataManager::Factory);
#ifdef CHROME_PERSONALIZATION
url_util::AddStandardScheme(kPersonalizationScheme);
URLRequest::RegisterProtocolFactory(kPersonalizationScheme,
@@ -137,9 +139,10 @@
std::string* path) {
#ifdef CHROME_PERSONALIZATION
DCHECK(url.SchemeIs(kChromeURLScheme) ||
- url.SchemeIs(kPersonalizationScheme));
+ url.SchemeIs(kPersonalizationScheme) ||
+ url.SchemeIs(chrome::kPrintScheme));
#else
- DCHECK(url.SchemeIs(kChromeURLScheme));
+ DCHECK(url.SchemeIs(kChromeURLScheme) || url.SchemeIs(chrome::kPrintScheme));
#endif
if (!url.is_valid()) {
@@ -149,13 +152,20 @@
// Our input looks like: chrome://source_name/extra_bits?foo .
// So the url's "host" is our source, and everything after the host is
- // the path.
- source_name->assign(url.host());
+ // the path. For print:url schemes, we assume its always print.
+ if (url.SchemeIs(chrome::kPrintScheme))
+ source_name->assign(chrome::kPrintScheme);
+ else
+ source_name->assign(url.host());
const std::string& spec = url.possibly_invalid_spec();
const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false);
- ++offset; // Skip the slash at the beginning of the path.
+
+ // We need to skip the slash at the beginning of the path for non print urls.
+ if (!url.SchemeIs(chrome::kPrintScheme))
+ ++offset;
+
if (offset < static_cast<int>(spec.size()))
path->assign(spec.substr(offset));
}
« no previous file with comments | « chrome/browser/child_process_security_policy.cc ('k') | chrome/browser/dom_ui/dom_ui_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698