diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-25 17:08:42 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-25 17:08:42 +0000 |
commit | 918059bd06841c5ebc2040162434748834a99615 (patch) | |
tree | 2fce36d6a8a5e86421a2380f613ba4889b2a2718 | |
parent | e2a70f76250f3d46fd5b3f73c1bd56cfe622201e (diff) | |
download | chromium_src-918059bd06841c5ebc2040162434748834a99615.zip chromium_src-918059bd06841c5ebc2040162434748834a99615.tar.gz chromium_src-918059bd06841c5ebc2040162434748834a99615.tar.bz2 |
Remove previous print preview work in preparation for new work.
The new work will take a very different approach (using a component extension,
similar to the bookmark manager).
This basically reverts the following commits:
- http://src.chromium.org/viewvc/chrome?view=rev&revision=20595
(http://codereview.chromium.org/155067)
- http://src.chromium.org/viewvc/chrome?view=rev&revision=19918
(http://codereview.chromium.org/155051)
- http://src.chromium.org/viewvc/chrome?view=rev&revision=19906
(http://codereview.chromium.org/150207)
BUG=173
TEST=everything still builds
Review URL: http://codereview.chromium.org/2156003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48162 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 12 | ||||
-rw-r--r-- | chrome/browser/browser_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/child_process_security_policy.cc | 25 | ||||
-rw-r--r-- | chrome/browser/child_process_security_policy_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 19 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_factory.cc | 10 | ||||
-rw-r--r-- | chrome/browser/dom_ui/print_ui.cc | 69 | ||||
-rw-r--r-- | chrome/browser/dom_ui/print_ui.h | 41 | ||||
-rw-r--r-- | chrome/browser/history/history.cc | 3 | ||||
-rw-r--r-- | chrome/browser/resources/print_tab.css | 2 | ||||
-rw-r--r-- | chrome/browser/resources/print_tab.html | 20 | ||||
-rw-r--r-- | chrome/browser/resources/print_tab.js | 2 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/common/url_constants.cc | 1 | ||||
-rw-r--r-- | chrome/common/url_constants.h | 1 | ||||
-rw-r--r-- | chrome/renderer/render_thread.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 3 |
17 files changed, 22 insertions, 202 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 341afa2..035a1ea 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -133,8 +133,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( // should still claim to handle them. if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) || LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) || - LowerCaseEqualsASCII(parsed_scheme, chrome::kDataScheme) || - LowerCaseEqualsASCII(parsed_scheme, chrome::kPrintScheme)) + LowerCaseEqualsASCII(parsed_scheme, chrome::kDataScheme)) return URL; // Finally, check and see if the user has explicitly opened this scheme as @@ -318,12 +317,11 @@ void AutocompleteInput::ParseForEmphasizeComponents( *host = parts.host; int after_scheme_and_colon = parts.scheme.end() + 1; - // For the view-source and print schemes, we should emphasize the scheme and - // host of the URL qualified by the scheme prefix. - if ((LowerCaseEqualsASCII(scheme_str, chrome::kViewSourceScheme) || - LowerCaseEqualsASCII(scheme_str, chrome::kPrintScheme)) && + // For the view-source scheme, we should emphasize the scheme and host of the + // URL qualified by the view-source prefix. + if (LowerCaseEqualsASCII(scheme_str, chrome::kViewSourceScheme) && (static_cast<int>(text.length()) > after_scheme_and_colon)) { - // Obtain the URL prefixed by scheme and parse it. + // Obtain the URL prefixed by view-source and parse it. std::wstring real_url(text.substr(after_scheme_and_colon)); url_parse::Parsed real_parts; AutocompleteInput::Parse(real_url, desired_tld, &real_parts, NULL); diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 160d96a..44fe8cb 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -57,9 +57,6 @@ without changes to the corresponding grd file. paaaae --> <include name="IDR_EXTENSIONS_INFOBAR_CSS" file="resources\extensions_infobar.css" flattenhtml="true" type="BINDATA" /> <include name="IDR_EXTENSIONS_TOOLSTRIP_THEME_CSS" file="resources\extensions_toolstrip.css" flattenhtml="true" type="BINDATA" /> <include name="IDR_PLUGINS_HTML" file="resources\plugins.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_PRINT_TAB_HTML" file="resources\print_tab.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_PRINT_TAB_CSS" file="resources\print_tab.css" type="BINDATA" /> - <include name="IDR_PRINT_TAB_JS" file="resources\print_tab.js" type="BINDATA" /> <include name="IDR_ABOUT_SYNC_HTML" file="sync\resources\about_sync.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_GAIA_LOGIN_HTML" file="sync\resources\gaia_login.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_SYNC_SETUP_FLOW_HTML" file="sync\resources\setup_flow.html" flattenhtml="true" type="BINDATA" /> diff --git a/chrome/browser/child_process_security_policy.cc b/chrome/browser/child_process_security_policy.cc index 1c4e22b..723483d 100644 --- a/chrome/browser/child_process_security_policy.cc +++ b/chrome/browser/child_process_security_policy.cc @@ -114,7 +114,6 @@ ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() { RegisterPseudoScheme(chrome::kAboutScheme); RegisterPseudoScheme(chrome::kJavaScriptScheme); RegisterPseudoScheme(chrome::kViewSourceScheme); - RegisterPseudoScheme(chrome::kPrintScheme); } ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() { @@ -190,11 +189,10 @@ void ChildProcessSecurityPolicy::GrantRequestURL( return; // The scheme has already been white-listed for every renderer. if (IsPseudoScheme(url.scheme())) { - // The view-source and print schemes are a special case of a pseudo URL that - // eventually results in requesting its embedded URL. - if (url.SchemeIs(chrome::kViewSourceScheme) || - url.SchemeIs(chrome::kPrintScheme)) { - // URLs with the view-source and print schemes typically look like: + // The view-source scheme is a special case of a pseudo-URL that eventually + // results in requesting its embedded URL. + if (url.SchemeIs(chrome::kViewSourceScheme)) { + // URLs with the view-source scheme typically look like: // view-source:http://www.google.com/a // In order to request these URLs, the renderer needs to be able to // request the embedded URL. @@ -256,9 +254,6 @@ void ChildProcessSecurityPolicy::GrantDOMUIBindings(int renderer_id) { // DOM UI bindings need the ability to request chrome: URLs. state->second->GrantScheme(chrome::kChromeUIScheme); - // DOM UI bindings need the ability to request print: URLs. - state->second->GrantScheme(chrome::kPrintScheme); - // DOM UI pages can contain links to file:// URLs. state->second->GrantScheme(chrome::kFileScheme); } @@ -304,14 +299,12 @@ bool ChildProcessSecurityPolicy::CanRequestURL( if (IsPseudoScheme(url.scheme())) { // There are a number of special cases for pseudo schemes. - if (url.SchemeIs(chrome::kViewSourceScheme) || - url.SchemeIs(chrome::kPrintScheme)) { - // View-source and print URL's are allowed if the renderer is permitted - // to request the embedded URL. Careful to avoid pointless recursion. + if (url.SchemeIs(chrome::kViewSourceScheme)) { + // A view-source URL is allowed if the renderer is permitted to request + // the embedded URL. Careful to avoid pointless recursion. GURL child_url(url.path()); - if (child_url.SchemeIs(chrome::kPrintScheme) || - (child_url.SchemeIs(chrome::kViewSourceScheme) && - url.SchemeIs(chrome::kViewSourceScheme))) + if (child_url.SchemeIs(chrome::kViewSourceScheme) && + url.SchemeIs(chrome::kViewSourceScheme)) return false; return CanRequestURL(renderer_id, child_url); diff --git a/chrome/browser/child_process_security_policy_unittest.cc b/chrome/browser/child_process_security_policy_unittest.cc index 0f75f72..46279c7 100644 --- a/chrome/browser/child_process_security_policy_unittest.cc +++ b/chrome/browser/child_process_security_policy_unittest.cc @@ -175,12 +175,6 @@ TEST_F(ChildProcessSecurityPolicyTest, ViewSource) { EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("file:///etc/passwd"))); EXPECT_FALSE(p->CanRequestURL( kRendererID, GURL("view-source:view-source:http://www.google.com/"))); - EXPECT_FALSE(p->CanRequestURL( - kRendererID, GURL("view-source:print:http://www.google.com/"))); - EXPECT_TRUE(p->CanRequestURL( - kRendererID, GURL("print:view-source:http://www.google.com/"))); - EXPECT_FALSE(p->CanRequestURL(kRendererID, - GURL("print:print:http://www.google.com/"))); p->GrantRequestURL(kRendererID, GURL("view-source:file:///etc/passwd")); // View source needs to be able to request the embedded scheme. diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index e0175e8..920d937 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -107,8 +107,6 @@ void RegisterURLRequestChromeJob() { URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme, &ChromeURLDataManager::Factory); - URLRequest::RegisterProtocolFactory(chrome::kPrintScheme, - &ChromeURLDataManager::Factory); } void UnregisterURLRequestChromeJob() { @@ -129,8 +127,7 @@ void UnregisterURLRequestChromeJob() { void ChromeURLDataManager::URLToRequest(const GURL& url, std::string* source_name, std::string* path) { - DCHECK(url.SchemeIs(chrome::kChromeUIScheme) || - url.SchemeIs(chrome::kPrintScheme)); + DCHECK(url.SchemeIs(chrome::kChromeUIScheme)); if (!url.is_valid()) { NOTREACHED(); @@ -139,19 +136,13 @@ void ChromeURLDataManager::URLToRequest(const GURL& url, // 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. 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()); + // the path. + 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); - - // We need to skip the slash at the beginning of the path for non print urls. - if (!url.SchemeIs(chrome::kPrintScheme)) - ++offset; + // + 1 to skip the slash at the beginning of the path. + int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false) + 1; if (offset < static_cast<int>(spec.size())) path->assign(spec.substr(offset)); diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index b9af9ee..0ef066a 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -15,7 +15,6 @@ #include "chrome/browser/dom_ui/net_internals_ui.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/dom_ui/plugins_ui.h" -#include "chrome/browser/dom_ui/print_ui.h" #include "chrome/browser/extensions/extension_dom_ui.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/extensions/extensions_ui.h" @@ -64,12 +63,6 @@ static DOMUIFactoryFunction GetDOMUIFactoryFunction(const GURL& url) { if (url.SchemeIs(chrome::kExtensionScheme)) return &NewDOMUI<ExtensionDOMUI>; -// TODO(mhm) Make sure this ifdef is removed once print is complete. -#if !defined(GOOGLE_CHROME_BUILD) - if (url.SchemeIs(chrome::kPrintScheme)) - return &NewDOMUI<PrintUI>; -#endif - // All platform builds of Chrome will need to have a cloud printing // dialog as backup. It's just that on Chrome OS, it's the only // print dialog. @@ -131,8 +124,7 @@ DOMUITypeID DOMUIFactory::GetDOMUIType(const GURL& url) { bool DOMUIFactory::HasDOMUIScheme(const GURL& url) { return url.SchemeIs(chrome::kChromeInternalScheme) || url.SchemeIs(chrome::kChromeUIScheme) || - url.SchemeIs(chrome::kExtensionScheme) || - url.SchemeIs(chrome::kPrintScheme); + url.SchemeIs(chrome::kExtensionScheme); } // static diff --git a/chrome/browser/dom_ui/print_ui.cc b/chrome/browser/dom_ui/print_ui.cc deleted file mode 100644 index 8b213f5..0000000 --- a/chrome/browser/dom_ui/print_ui.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2009 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/browser/dom_ui/print_ui.h" - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "base/message_loop.h" -#include "base/singleton.h" -#include "base/thread.h" -#include "base/values.h" -#include "chrome/browser/chrome_thread.h" -#include "chrome/common/jstemplate_builder.h" -#include "chrome/common/url_constants.h" - -#include "grit/browser_resources.h" -#include "grit/generated_resources.h" - -/////////////////////////////////////////////////////////////////////////////// -// -// PrintUI -// -/////////////////////////////////////////////////////////////////////////////// - -PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) { - PrintUIHTMLSource* html_source = new PrintUIHTMLSource(); - - // Set up the print:url source. - ChromeThread::PostTask( - ChromeThread::IO, FROM_HERE, - NewRunnableMethod( - Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, - make_scoped_refptr(html_source))); -} - -//////////////////////////////////////////////////////////////////////////////// -// -// PrintUIHTMLSource -// -//////////////////////////////////////////////////////////////////////////////// - -PrintUIHTMLSource::PrintUIHTMLSource() - : DataSource(chrome::kPrintScheme, MessageLoop::current()) { -} - -void PrintUIHTMLSource::StartDataRequest(const std::string& path, - bool is_off_the_record, - int request_id) { - // Setup a dictionary so that the html page could read the values. - DictionaryValue localized_strings; - localized_strings.SetString(L"title", l10n_util::GetString(IDS_PRINT)); - - SetFontAndTextDirection(&localized_strings); - - // Setup the print html page. - static const base::StringPiece print_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_PRINT_TAB_HTML)); - const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( - print_html, &localized_strings); - - // Load the print html page into the tab contents. - scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); - html_bytes->data.resize(full_html.size()); - std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); - SendResponse(request_id, html_bytes); -} diff --git a/chrome/browser/dom_ui/print_ui.h b/chrome/browser/dom_ui/print_ui.h deleted file mode 100644 index 02b1d0d..0000000 --- a/chrome/browser/dom_ui/print_ui.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2009 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_BROWSER_DOM_UI_PRINT_UI_H_ -#define CHROME_BROWSER_DOM_UI_PRINT_UI_H_ - -#include <string> - -#include "chrome/browser/dom_ui/chrome_url_data_manager.h" -#include "chrome/browser/dom_ui/dom_ui.h" - -// The TabContents used for the print page. -class PrintUI : public DOMUI { - public: - explicit PrintUI(TabContents* contents); - - private: - DISALLOW_COPY_AND_ASSIGN(PrintUI); -}; - -// To serve dynamic print data off of chrome. -class PrintUIHTMLSource : public ChromeURLDataManager::DataSource { - public: - PrintUIHTMLSource(); - - // ChromeURLDataManager overrides. - virtual void StartDataRequest(const std::string& path, - bool is_off_the_record, - int request_id); - virtual std::string GetMimeType(const std::string&) const { - return "text/html"; - } - - private: - ~PrintUIHTMLSource() {} - - DISALLOW_COPY_AND_ASSIGN(PrintUIHTMLSource); -}; - -#endif // CHROME_BROWSER_DOM_UI_PRINT_UI_H_ diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index c8ca288..630c490 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -653,8 +653,7 @@ bool HistoryService::CanAddURL(const GURL& url) const { if (url.SchemeIs(chrome::kJavaScriptScheme) || url.SchemeIs(chrome::kChromeUIScheme) || url.SchemeIs(chrome::kViewSourceScheme) || - url.SchemeIs(chrome::kChromeInternalScheme) || - url.SchemeIs(chrome::kPrintScheme)) + url.SchemeIs(chrome::kChromeInternalScheme)) return false; if (url.SchemeIs(chrome::kAboutScheme)) { diff --git a/chrome/browser/resources/print_tab.css b/chrome/browser/resources/print_tab.css deleted file mode 100644 index 90dd24b..0000000 --- a/chrome/browser/resources/print_tab.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Initial page for print tab css */ - diff --git a/chrome/browser/resources/print_tab.html b/chrome/browser/resources/print_tab.html deleted file mode 100644 index 8c74d2f..0000000 --- a/chrome/browser/resources/print_tab.html +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html i18n-values="dir:textdirection"> - <head> - <meta charset="utf-8"> - <title i18n-content="title"></title> - <link rel="stylesheet" href="print_tab.css"> - </head> - <body> - <center> - <h1>Chromium Print Page</h1> - </center> - <div class="text"> - <p>This is an <i>in-progress</i> print preview and settings page - in chromium.</p> - <p>Borat says "Very nice!"</p> - </div> - </body> - <script src="print_tab.js"></script> -</html> - diff --git a/chrome/browser/resources/print_tab.js b/chrome/browser/resources/print_tab.js deleted file mode 100644 index d65d22c..0000000 --- a/chrome/browser/resources/print_tab.js +++ /dev/null @@ -1,2 +0,0 @@ -/* Initial page for print tab js */ - diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 97357c7..7b1eda9 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -964,8 +964,6 @@ 'browser/dom_ui/ntp_resource_cache.h', 'browser/dom_ui/plugins_ui.cc', 'browser/dom_ui/plugins_ui.h', - 'browser/dom_ui/print_ui.cc', - 'browser/dom_ui/print_ui.h', 'browser/dom_ui/shown_sections_handler.cc', 'browser/dom_ui/shown_sections_handler.h', 'browser/dom_ui/tips_handler.cc', diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 6542fd1..70bdfc1 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -22,7 +22,6 @@ const char kHttpsScheme[] = "https"; const char kJavaScriptScheme[] = "javascript"; const char kMailToScheme[] = "mailto"; const char kMetadataScheme[] = "metadata"; -const char kPrintScheme[] = "print"; const char kUserScriptScheme[] = "chrome-user-script"; const char kViewSourceScheme[] = "view-source"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index e3cf3d9..b58d8d7 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -23,7 +23,6 @@ extern const char kHttpsScheme[]; extern const char kJavaScriptScheme[]; extern const char kMailToScheme[]; extern const char kMetadataScheme[]; -extern const char kPrintScheme[]; extern const char kUserScriptScheme[]; extern const char kViewSourceScheme[]; diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index fad5130..767fc37 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -800,11 +800,6 @@ void RenderThread::EnsureWebKitInitialized() { WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); - // print: pages should be not accessible by normal context. - WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme)); - WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme); - WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme); - #if defined(OS_WIN) // We don't yet support Gears on non-Windows, so don't tell pages that we do. WebScriptController::registerExtension(extensions_v8::GearsExtension::Get()); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 5af24b9..e9bd104 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2284,8 +2284,7 @@ WebNavigationPolicy RenderView::decidePolicyForNavigation( if (CrossesExtensionExtents(frame, url) || BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || frame->isViewSourceModeEnabled() || - url.SchemeIs(chrome::kViewSourceScheme) || - url.SchemeIs(chrome::kPrintScheme)) { + url.SchemeIs(chrome::kViewSourceScheme)) { OpenURL(url, GURL(), default_policy); return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. } |