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

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: Uploading my changes again. 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
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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 1346
1346 void TabContents::EmailPageLocation() { 1347 void TabContents::EmailPageLocation() {
1347 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); 1348 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false);
1348 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); 1349 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false);
1349 std::string mailto = std::string("mailto:?subject=Fwd:%20") + 1350 std::string mailto = std::string("mailto:?subject=Fwd:%20") +
1350 title + "&body=%0A%0A" + page_url; 1351 title + "&body=%0A%0A" + page_url;
1351 platform_util::OpenExternal(GURL(mailto)); 1352 platform_util::OpenExternal(GURL(mailto));
1352 } 1353 }
1353 1354
1354 void TabContents::PrintPreview() { 1355 void TabContents::PrintPreview() {
1355 // We don't show the print preview yet, only the print dialog. 1356 if (CommandLine::ForCurrentProcess()->HasSwitch(
1356 PrintNow(); 1357 switches::kEnablePrintPreview)) {
1358 if (showing_interstitial_page())
1359 return;
1360 render_view_host()->PrintPreview();
1361 } else {
1362 PrintNow();
1363 }
1357 } 1364 }
1358 1365
1359 bool TabContents::PrintNow() { 1366 bool TabContents::PrintNow() {
1360 // We can't print interstitial page for now. 1367 // We can't print interstitial page for now.
1361 if (showing_interstitial_page()) 1368 if (showing_interstitial_page())
1362 return false; 1369 return false;
1363 1370
1364 return render_view_host()->PrintPages(); 1371 return render_view_host()->PrintPages();
1365 } 1372 }
1366 1373
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after
3326 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3333 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3327 } 3334 }
3328 3335
3329 Profile* TabContents::GetProfileForPasswordManager() { 3336 Profile* TabContents::GetProfileForPasswordManager() {
3330 return profile(); 3337 return profile();
3331 } 3338 }
3332 3339
3333 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3340 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3334 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3341 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3335 } 3342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698