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

Side by Side Diff: chrome/browser/printing/print_view_manager.cc

Issue 9030032: Get rid of a bunch of tab_contents.h includes from chrome. These are all trivial changes to use W... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/printing/print_view_manager.h" 5 #include "chrome/browser/printing/print_view_manager.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/printing/print_job.h" 14 #include "chrome/browser/printing/print_job.h"
15 #include "chrome/browser/printing/print_job_manager.h" 15 #include "chrome/browser/printing/print_job_manager.h"
16 #include "chrome/browser/printing/print_preview_tab_controller.h" 16 #include "chrome/browser/printing/print_preview_tab_controller.h"
17 #include "chrome/browser/printing/printer_query.h" 17 #include "chrome/browser/printing/printer_query.h"
18 #include "chrome/browser/printing/print_view_manager_observer.h" 18 #include "chrome/browser/printing/print_view_manager_observer.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/browser/ui/webui/print_preview_ui.h" 20 #include "chrome/browser/ui/webui/print_preview_ui.h"
21 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/print_messages.h" 22 #include "chrome/common/print_messages.h"
23 #include "content/browser/renderer_host/render_view_host.h" 23 #include "content/browser/renderer_host/render_view_host.h"
24 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
27 #include "content/public/browser/web_contents.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "printing/metafile.h" 29 #include "printing/metafile.h"
30 #include "printing/metafile_impl.h" 30 #include "printing/metafile_impl.h"
31 #include "printing/printed_document.h" 31 #include "printing/printed_document.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 33
34 using base::TimeDelta; 34 using base::TimeDelta;
35 using content::BrowserThread; 35 using content::BrowserThread;
36 36
37 namespace { 37 namespace {
(...skipping 20 matching lines...) Expand all
58 typedef std::map<content::RenderProcessHost*, base::Closure> 58 typedef std::map<content::RenderProcessHost*, base::Closure>
59 ScriptedPrintPreviewClosureMap; 59 ScriptedPrintPreviewClosureMap;
60 static base::LazyInstance<ScriptedPrintPreviewClosureMap> 60 static base::LazyInstance<ScriptedPrintPreviewClosureMap>
61 g_scripted_print_preview_closure_map = LAZY_INSTANCE_INITIALIZER; 61 g_scripted_print_preview_closure_map = LAZY_INSTANCE_INITIALIZER;
62 62
63 } // namespace 63 } // namespace
64 64
65 namespace printing { 65 namespace printing {
66 66
67 PrintViewManager::PrintViewManager(TabContentsWrapper* tab) 67 PrintViewManager::PrintViewManager(TabContentsWrapper* tab)
68 : content::WebContentsObserver(tab->tab_contents()), 68 : content::WebContentsObserver(tab->web_contents()),
69 tab_(tab), 69 tab_(tab),
70 number_pages_(0), 70 number_pages_(0),
71 printing_succeeded_(false), 71 printing_succeeded_(false),
72 inside_inner_message_loop_(false), 72 inside_inner_message_loop_(false),
73 observer_(NULL), 73 observer_(NULL),
74 cookie_(0), 74 cookie_(0),
75 print_preview_state_(NOT_PREVIEWING), 75 print_preview_state_(NOT_PREVIEWING),
76 scripted_print_preview_rph_(NULL) { 76 scripted_print_preview_rph_(NULL) {
77 #if defined(OS_POSIX) && !defined(OS_MACOSX) 77 #if defined(OS_POSIX) && !defined(OS_MACOSX)
78 expecting_first_page_ = true; 78 expecting_first_page_ = true;
(...skipping 16 matching lines...) Expand all
95 95
96 bool PrintViewManager::AdvancedPrintNow() { 96 bool PrintViewManager::AdvancedPrintNow() {
97 PrintPreviewTabController* tab_controller = 97 PrintPreviewTabController* tab_controller =
98 PrintPreviewTabController::GetInstance(); 98 PrintPreviewTabController::GetInstance();
99 if (!tab_controller) 99 if (!tab_controller)
100 return false; 100 return false;
101 TabContentsWrapper* print_preview_tab = 101 TabContentsWrapper* print_preview_tab =
102 tab_controller->GetPrintPreviewForTab(tab_); 102 tab_controller->GetPrintPreviewForTab(tab_);
103 if (print_preview_tab) { 103 if (print_preview_tab) {
104 // Preview tab exist for current tab or current tab is preview tab. 104 // Preview tab exist for current tab or current tab is preview tab.
105 if (!print_preview_tab->tab_contents()->GetWebUI()) 105 if (!print_preview_tab->web_contents()->GetWebUI())
106 return false; 106 return false;
107 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 107 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
108 print_preview_tab->tab_contents()->GetWebUI()); 108 print_preview_tab->web_contents()->GetWebUI());
109 print_preview_ui->OnShowSystemDialog(); 109 print_preview_ui->OnShowSystemDialog();
110 return true; 110 return true;
111 } else { 111 } else {
112 return PrintNow(); 112 return PrintNow();
113 } 113 }
114 } 114 }
115 115
116 bool PrintViewManager::PrintPreviewNow() { 116 bool PrintViewManager::PrintPreviewNow() {
117 if (print_preview_state_ != NOT_PREVIEWING) { 117 if (print_preview_state_ != NOT_PREVIEWING) {
118 NOTREACHED(); 118 NOTREACHED();
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 593 }
594 594
595 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { 595 bool PrintViewManager::PrintNowInternal(IPC::Message* message) {
596 // Don't print / print preview interstitials. 596 // Don't print / print preview interstitials.
597 if (web_contents()->ShowingInterstitialPage()) 597 if (web_contents()->ShowingInterstitialPage())
598 return false; 598 return false;
599 return Send(message); 599 return Send(message);
600 } 600 }
601 601
602 } // namespace printing 602 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_message_handler.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698