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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.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
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/renderer_host/render_view_host.h" 5 #include "chrome/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/metrics/stats_counters.h" 14 #include "base/metrics/stats_counters.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/browser_list.h" 18 #include "chrome/browser/browser_list.h"
19 #include "chrome/browser/child_process_security_policy.h" 19 #include "chrome/browser/child_process_security_policy.h"
20 #include "chrome/browser/cross_site_request_manager.h" 20 #include "chrome/browser/cross_site_request_manager.h"
21 #include "chrome/browser/debugger/devtools_manager.h" 21 #include "chrome/browser/debugger/devtools_manager.h"
22 #include "chrome/browser/dom_operation_notification_details.h" 22 #include "chrome/browser/dom_operation_notification_details.h"
23 #include "chrome/browser/extensions/extension_message_service.h" 23 #include "chrome/browser/extensions/extension_message_service.h"
24 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" 24 #include "chrome/browser/in_process_webkit/session_storage_namespace.h"
25 #include "chrome/browser/net/predictor_api.h" 25 #include "chrome/browser/net/predictor_api.h"
26 #include "chrome/browser/notifications/desktop_notification_service.h" 26 #include "chrome/browser/notifications/desktop_notification_service.h"
27 #include "chrome/browser/printing/print_preview_tab_controller.h"
27 #include "chrome/browser/profile.h" 28 #include "chrome/browser/profile.h"
28 #include "chrome/browser/renderer_host/render_process_host.h" 29 #include "chrome/browser/renderer_host/render_process_host.h"
29 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 30 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
30 #include "chrome/browser/renderer_host/render_widget_host.h" 31 #include "chrome/browser/renderer_host/render_widget_host.h"
31 #include "chrome/browser/renderer_host/render_widget_host_view.h" 32 #include "chrome/browser/renderer_host/render_widget_host_view.h"
32 #include "chrome/browser/renderer_host/site_instance.h" 33 #include "chrome/browser/renderer_host/site_instance.h"
33 #include "chrome/common/bindings_policy.h" 34 #include "chrome/common/bindings_policy.h"
34 #include "chrome/common/chrome_constants.h" 35 #include "chrome/common/chrome_constants.h"
35 #include "chrome/common/chrome_switches.h" 36 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/native_web_keyboard_event.h" 37 #include "chrome/common/native_web_keyboard_event.h"
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 view->ShowPopupMenu(params.bounds, 2210 view->ShowPopupMenu(params.bounds,
2210 params.item_height, 2211 params.item_height,
2211 params.item_font_size, 2212 params.item_font_size,
2212 params.selected_item, 2213 params.selected_item,
2213 params.popup_items, 2214 params.popup_items,
2214 params.right_aligned); 2215 params.right_aligned);
2215 } 2216 }
2216 } 2217 }
2217 #endif 2218 #endif
2218 2219
2220 TabContents* RenderViewHost::GetOrCreatePrintPreviewTab() {
2221 TabContents* initiator_tab = delegate_ ? delegate_->GetAsTabContents() : NULL;
2222 if (initiator_tab) {
2223 // Get/Create preview tab for initiator tab.
2224 printing::PrintPreviewTabController* tab_controller =
2225 printing::PrintPreviewTabController::GetInstance();
2226 if (tab_controller)
2227 return tab_controller->GetOrCreatePreviewTab(
2228 initiator_tab, delegate_->GetBrowserWindowID());
2229 }
2230 return NULL;
2231 }
2232
2219 #if defined(OS_MACOSX) || defined(OS_WIN) 2233 #if defined(OS_MACOSX) || defined(OS_WIN)
2220 void RenderViewHost::OnPageReadyForPreview( 2234 void RenderViewHost::OnPageReadyForPreview(
2221 const ViewHostMsg_DidPrintPage_Params& params) { 2235 const ViewHostMsg_DidPrintPage_Params& params) {
2236 // Get/Create print preview tab.
2237 TabContents* print_preview_tab = GetOrCreatePrintPreviewTab();
2238 DCHECK(print_preview_tab);
2239
2222 // TODO(kmadhusu): Function definition needs to be changed. 2240 // TODO(kmadhusu): Function definition needs to be changed.
2223 // 'params' contains the metafile handle for preview. 2241 // 'params' contains the metafile handle for preview.
2224 2242
2225 // Send the printingDone msg for now. 2243 // Send the printingDone msg for now.
2226 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); 2244 Send(new ViewMsg_PrintingDone(routing_id(), -1, true));
2227 } 2245 }
2228 #else 2246 #else
2229 void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) { 2247 void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) {
2248 // Get/Create print preview tab.
2249 TabContents* print_preview_tab = GetOrCreatePrintPreviewTab();
2250 DCHECK(print_preview_tab);
2251
2230 // TODO(kmadhusu): Function definition needs to be changed. 2252 // TODO(kmadhusu): Function definition needs to be changed.
2231 // fd_in_browser should be the file descriptor of the metafile. 2253 // fd_in_browser should be the file descriptor of the metafile.
2232 2254
2233 // Send the printingDone msg for now. 2255 // Send the printingDone msg for now.
2234 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); 2256 Send(new ViewMsg_PrintingDone(routing_id(), -1, true));
2235 } 2257 }
2236 #endif 2258 #endif
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698