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

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

Issue 4338001: Implement print preview tab controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "chrome/browser/message_box_handler.h" 52 #include "chrome/browser/message_box_handler.h"
53 #include "chrome/browser/load_from_memory_cache_details.h" 53 #include "chrome/browser/load_from_memory_cache_details.h"
54 #include "chrome/browser/load_notification_details.h" 54 #include "chrome/browser/load_notification_details.h"
55 #include "chrome/browser/metrics/metric_event_duration_details.h" 55 #include "chrome/browser/metrics/metric_event_duration_details.h"
56 #include "chrome/browser/modal_html_dialog_delegate.h" 56 #include "chrome/browser/modal_html_dialog_delegate.h"
57 #include "chrome/browser/omnibox_search_hint.h" 57 #include "chrome/browser/omnibox_search_hint.h"
58 #include "chrome/browser/password_manager/password_manager.h" 58 #include "chrome/browser/password_manager/password_manager.h"
59 #include "chrome/browser/platform_util.h" 59 #include "chrome/browser/platform_util.h"
60 #include "chrome/browser/plugin_installer.h" 60 #include "chrome/browser/plugin_installer.h"
61 #include "chrome/browser/prefs/pref_service.h" 61 #include "chrome/browser/prefs/pref_service.h"
62 #include "chrome/browser/printing/print_preview_tab_controller.h"
62 #include "chrome/browser/printing/print_view_manager.h" 63 #include "chrome/browser/printing/print_view_manager.h"
63 #include "chrome/browser/profile.h" 64 #include "chrome/browser/profile.h"
64 #include "chrome/browser/renderer_host/render_process_host.h" 65 #include "chrome/browser/renderer_host/render_process_host.h"
65 #include "chrome/browser/renderer_host/render_view_host.h" 66 #include "chrome/browser/renderer_host/render_view_host.h"
66 #include "chrome/browser/renderer_host/render_widget_host_view.h" 67 #include "chrome/browser/renderer_host/render_widget_host_view.h"
67 #include "chrome/browser/renderer_host/resource_request_details.h" 68 #include "chrome/browser/renderer_host/resource_request_details.h"
68 #include "chrome/browser/renderer_host/site_instance.h" 69 #include "chrome/browser/renderer_host/site_instance.h"
69 #include "chrome/browser/renderer_host/web_cache_manager.h" 70 #include "chrome/browser/renderer_host/web_cache_manager.h"
70 #include "chrome/browser/renderer_preferences_util.h" 71 #include "chrome/browser/renderer_preferences_util.h"
71 #include "chrome/browser/search_engines/template_url.h" 72 #include "chrome/browser/search_engines/template_url.h"
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1345
1345 void TabContents::EmailPageLocation() { 1346 void TabContents::EmailPageLocation() {
1346 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); 1347 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false);
1347 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); 1348 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false);
1348 std::string mailto = std::string("mailto:?subject=Fwd:%20") + 1349 std::string mailto = std::string("mailto:?subject=Fwd:%20") +
1349 title + "&body=%0A%0A" + page_url; 1350 title + "&body=%0A%0A" + page_url;
1350 platform_util::OpenExternal(GURL(mailto)); 1351 platform_util::OpenExternal(GURL(mailto));
1351 } 1352 }
1352 1353
1353 void TabContents::PrintPreview() { 1354 void TabContents::PrintPreview() {
1354 // We don't show the print preview yet, only the print dialog. 1355 if (CommandLine::ForCurrentProcess()->HasSwitch(
1355 PrintNow(); 1356 switches::kEnablePrintPreview)) {
1357 if (showing_interstitial_page())
1358 return;
1359 render_view_host()->PrintPreview();
1360 } else {
1361 PrintNow();
1362 }
1356 } 1363 }
1357 1364
1358 bool TabContents::PrintNow() { 1365 bool TabContents::PrintNow() {
1359 // We can't print interstitial page for now. 1366 // We can't print interstitial page for now.
1360 if (showing_interstitial_page()) 1367 if (showing_interstitial_page())
1361 return false; 1368 return false;
1362 1369
1363 return render_view_host()->PrintPages(); 1370 return render_view_host()->PrintPages();
1364 } 1371 }
1365 1372
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3332 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3326 } 3333 }
3327 3334
3328 Profile* TabContents::GetProfileForPasswordManager() { 3335 Profile* TabContents::GetProfileForPasswordManager() {
3329 return profile(); 3336 return profile();
3330 } 3337 }
3331 3338
3332 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3339 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3333 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3340 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3334 } 3341 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698