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

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: Made code changes as per comments. 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/load_from_memory_cache_details.h" 54 #include "chrome/browser/load_from_memory_cache_details.h"
55 #include "chrome/browser/load_notification_details.h" 55 #include "chrome/browser/load_notification_details.h"
56 #include "chrome/browser/metrics/metric_event_duration_details.h" 56 #include "chrome/browser/metrics/metric_event_duration_details.h"
57 #include "chrome/browser/modal_html_dialog_delegate.h" 57 #include "chrome/browser/modal_html_dialog_delegate.h"
58 #include "chrome/browser/omnibox_search_hint.h" 58 #include "chrome/browser/omnibox_search_hint.h"
59 #include "chrome/browser/password_manager/password_manager.h" 59 #include "chrome/browser/password_manager/password_manager.h"
60 #include "chrome/browser/platform_util.h" 60 #include "chrome/browser/platform_util.h"
61 #include "chrome/browser/plugin_installer.h" 61 #include "chrome/browser/plugin_installer.h"
62 #include "chrome/browser/prefs/pref_service.h" 62 #include "chrome/browser/prefs/pref_service.h"
63 #include "chrome/browser/printing/print_view_manager.h" 63 #include "chrome/browser/printing/print_view_manager.h"
64 #include "chrome/browser/printing/print_preview_tab_controller.h"
Lei Zhang 2010/11/12 23:17:18 nit: (again) alphabetical order
kmadhusu 2010/11/13 00:05:59 Done.
64 #include "chrome/browser/profile.h" 65 #include "chrome/browser/profile.h"
65 #include "chrome/browser/renderer_host/render_process_host.h" 66 #include "chrome/browser/renderer_host/render_process_host.h"
66 #include "chrome/browser/renderer_host/render_view_host.h" 67 #include "chrome/browser/renderer_host/render_view_host.h"
67 #include "chrome/browser/renderer_host/render_widget_host_view.h" 68 #include "chrome/browser/renderer_host/render_widget_host_view.h"
68 #include "chrome/browser/renderer_host/resource_request_details.h" 69 #include "chrome/browser/renderer_host/resource_request_details.h"
69 #include "chrome/browser/renderer_host/site_instance.h" 70 #include "chrome/browser/renderer_host/site_instance.h"
70 #include "chrome/browser/renderer_host/web_cache_manager.h" 71 #include "chrome/browser/renderer_host/web_cache_manager.h"
71 #include "chrome/browser/renderer_preferences_util.h" 72 #include "chrome/browser/renderer_preferences_util.h"
72 #include "chrome/browser/search_engines/template_url.h" 73 #include "chrome/browser/search_engines/template_url.h"
73 #include "chrome/browser/search_engines/template_url_fetcher.h" 74 #include "chrome/browser/search_engines/template_url_fetcher.h"
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 1347
1347 void TabContents::EmailPageLocation() { 1348 void TabContents::EmailPageLocation() {
1348 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); 1349 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false);
1349 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); 1350 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false);
1350 std::string mailto = std::string("mailto:?subject=Fwd:%20") + 1351 std::string mailto = std::string("mailto:?subject=Fwd:%20") +
1351 title + "&body=%0A%0A" + page_url; 1352 title + "&body=%0A%0A" + page_url;
1352 platform_util::OpenExternal(GURL(mailto)); 1353 platform_util::OpenExternal(GURL(mailto));
1353 } 1354 }
1354 1355
1355 void TabContents::PrintPreview() { 1356 void TabContents::PrintPreview() {
1356 // We don't show the print preview yet, only the print dialog. 1357 if (CommandLine::ForCurrentProcess()->HasSwitch(
1357 PrintNow(); 1358 switches::kEnablePrintPreview)) {
1359 if (showing_interstitial_page())
1360 return;
1361 render_view_host()->PrintPreview();
1362 } else {
1363 PrintNow();
1364 }
1358 } 1365 }
1359 1366
1360 bool TabContents::PrintNow() { 1367 bool TabContents::PrintNow() {
1361 // We can't print interstitial page for now. 1368 // We can't print interstitial page for now.
1362 if (showing_interstitial_page()) 1369 if (showing_interstitial_page())
1363 return false; 1370 return false;
1364 1371
1365 return render_view_host()->PrintPages(); 1372 return render_view_host()->PrintPages();
1366 } 1373 }
1367 1374
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3340 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3334 } 3341 }
3335 3342
3336 Profile* TabContents::GetProfileForPasswordManager() { 3343 Profile* TabContents::GetProfileForPasswordManager() {
3337 return profile(); 3344 return profile();
3338 } 3345 }
3339 3346
3340 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3347 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3341 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3348 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3342 } 3349 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698