OLD | NEW |
---|---|
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/blocked_plugin_manager.h" | 18 #include "chrome/browser/blocked_plugin_manager.h" |
19 #include "chrome/browser/browser_list.h" | 19 #include "chrome/browser/browser_list.h" |
20 #include "chrome/browser/child_process_security_policy.h" | 20 #include "chrome/browser/child_process_security_policy.h" |
21 #include "chrome/browser/cross_site_request_manager.h" | 21 #include "chrome/browser/cross_site_request_manager.h" |
22 #include "chrome/browser/debugger/devtools_manager.h" | 22 #include "chrome/browser/debugger/devtools_manager.h" |
23 #include "chrome/browser/dom_operation_notification_details.h" | 23 #include "chrome/browser/dom_operation_notification_details.h" |
24 #include "chrome/browser/extensions/extension_message_service.h" | 24 #include "chrome/browser/extensions/extension_message_service.h" |
25 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 25 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
26 #include "chrome/browser/net/predictor_api.h" | 26 #include "chrome/browser/net/predictor_api.h" |
27 #include "chrome/browser/notifications/desktop_notification_service.h" | 27 #include "chrome/browser/notifications/desktop_notification_service.h" |
28 #include "chrome/browser/printing/print_preview_tab_controller.h" | |
28 #include "chrome/browser/profile.h" | 29 #include "chrome/browser/profile.h" |
29 #include "chrome/browser/renderer_host/render_process_host.h" | 30 #include "chrome/browser/renderer_host/render_process_host.h" |
30 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 31 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
31 #include "chrome/browser/renderer_host/render_widget_host.h" | 32 #include "chrome/browser/renderer_host/render_widget_host.h" |
32 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 33 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
33 #include "chrome/browser/renderer_host/site_instance.h" | 34 #include "chrome/browser/renderer_host/site_instance.h" |
34 #include "chrome/common/bindings_policy.h" | 35 #include "chrome/common/bindings_policy.h" |
35 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/native_web_keyboard_event.h" | 38 #include "chrome/common/native_web_keyboard_event.h" |
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2228 view->ShowPopupMenu(params.bounds, | 2229 view->ShowPopupMenu(params.bounds, |
2229 params.item_height, | 2230 params.item_height, |
2230 params.item_font_size, | 2231 params.item_font_size, |
2231 params.selected_item, | 2232 params.selected_item, |
2232 params.popup_items, | 2233 params.popup_items, |
2233 params.right_aligned); | 2234 params.right_aligned); |
2234 } | 2235 } |
2235 } | 2236 } |
2236 #endif | 2237 #endif |
2237 | 2238 |
2239 TabContents* RenderViewHost::GetPrintPreviewTab() { | |
2240 // current_tab is initiator_tab | |
Lei Zhang
2010/11/12 23:17:18
nit: |current_tab| is initiator tab
kmadhusu
2010/11/13 00:05:59
Done.
| |
2241 TabContents* current_tab = delegate_? delegate_->GetAsTabContents() : NULL; | |
Lei Zhang
2010/11/12 23:17:18
nit: space before '?'
kmadhusu
2010/11/13 00:05:59
Done.
| |
2242 if (current_tab) { | |
2243 // Get/Create preview tab for initiator tab. | |
2244 printing::PrintPreviewTabController* tab_controller = | |
2245 printing::PrintPreviewTabController::GetInstance(); | |
2246 if (tab_controller) | |
2247 return tab_controller->GetOrCreatePreviewTab( | |
2248 current_tab, delegate_->GetBrowserWindowID()); | |
2249 } | |
2250 return NULL; | |
2251 } | |
2252 | |
2238 #if defined(OS_MACOSX) || defined(OS_WIN) | 2253 #if defined(OS_MACOSX) || defined(OS_WIN) |
2239 void RenderViewHost::OnPageReadyForPreview( | 2254 void RenderViewHost::OnPageReadyForPreview( |
2240 const ViewHostMsg_DidPrintPage_Params& params) { | 2255 const ViewHostMsg_DidPrintPage_Params& params) { |
2256 // Get the print preview tab. | |
2257 TabContents* preview_tab = GetPrintPreviewTab(); | |
2258 DCHECK(preview_tab); | |
2259 | |
2241 // TODO(kmadhusu): Function definition needs to be changed. | 2260 // TODO(kmadhusu): Function definition needs to be changed. |
2242 // 'params' contains the metafile handle for preview. | 2261 // 'params' contains the metafile handle for preview. |
2243 | 2262 |
2244 // Send the printingDone msg for now. | 2263 // Send the printingDone msg for now. |
2245 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); | 2264 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); |
2246 } | 2265 } |
2247 #else | 2266 #else |
2248 void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) { | 2267 void RenderViewHost::OnPagesReadyForPreview(int fd_in_browser) { |
2268 // Get the print preview tab. | |
2269 TabContents* preview_tab = GetPrintPreviewTab(); | |
2270 DCHECK(preview_tab); | |
2271 | |
2249 // TODO(kmadhusu): Function definition needs to be changed. | 2272 // TODO(kmadhusu): Function definition needs to be changed. |
2250 // fd_in_browser should be the file descriptor of the metafile. | 2273 // fd_in_browser should be the file descriptor of the metafile. |
2251 | 2274 |
2252 // Send the printingDone msg for now. | 2275 // Send the printingDone msg for now. |
2253 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); | 2276 Send(new ViewMsg_PrintingDone(routing_id(), -1, true)); |
2254 } | 2277 } |
2255 #endif | 2278 #endif |
OLD | NEW |