| OLD | NEW |
| 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_preview_tab_controller.h" | 5 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 12 #include "chrome/browser/printing/print_view_manager.h" | 13 #include "chrome/browser/printing/print_view_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sessions/restore_tab_helper.h" | 15 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 15 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 19 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 20 #include "chrome/browser/ui/webui/print_preview_ui.h" | 21 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 21 #include "chrome/common/chrome_content_client.h" | 22 #include "chrome/common/chrome_content_client.h" |
| 22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 24 #include "content/browser/plugin_service.h" | |
| 25 #include "content/browser/renderer_host/render_view_host.h" | 25 #include "content/browser/renderer_host/render_view_host.h" |
| 26 #include "content/browser/tab_contents/navigation_details.h" | 26 #include "content/browser/tab_contents/navigation_details.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | 27 #include "content/browser/tab_contents/tab_contents.h" |
| 28 #include "content/common/content_notification_types.h" | 28 #include "content/common/content_notification_types.h" |
| 29 #include "content/common/notification_details.h" | 29 #include "content/common/notification_details.h" |
| 30 #include "content/common/notification_source.h" | 30 #include "content/common/notification_source.h" |
| 31 #include "webkit/plugins/npapi/plugin_group.h" | 31 #include "webkit/plugins/npapi/plugin_group.h" |
| 32 #include "webkit/plugins/npapi/plugin_list.h" | 32 #include "webkit/plugins/npapi/plugin_list.h" |
| 33 #include "webkit/plugins/webplugininfo.h" | 33 #include "webkit/plugins/webplugininfo.h" |
| 34 | 34 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 48 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
| 49 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) { | 49 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) { |
| 50 internal_pdf_group = &plugin_groups[i]; | 50 internal_pdf_group = &plugin_groups[i]; |
| 51 break; | 51 break; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 if (internal_pdf_group) { | 54 if (internal_pdf_group) { |
| 55 std::vector<WebPluginInfo> plugins = internal_pdf_group->web_plugin_infos(); | 55 std::vector<WebPluginInfo> plugins = internal_pdf_group->web_plugin_infos(); |
| 56 DCHECK_EQ(plugins.size(), 1U); | 56 DCHECK_EQ(plugins.size(), 1U); |
| 57 | 57 |
| 58 PluginService::OverriddenPlugin plugin; | 58 webkit::WebPluginInfo plugin = plugins[0]; |
| 59 plugin.render_process_id = preview_tab->render_view_host()->process()->id(); | 59 plugin.enabled = WebPluginInfo::USER_ENABLED; |
| 60 plugin.render_view_id = preview_tab->render_view_host()->routing_id(); | 60 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( |
| 61 plugin.plugin = plugins[0]; | 61 preview_tab->render_view_host()->process()->id(), |
| 62 plugin.plugin.enabled = WebPluginInfo::USER_ENABLED; | 62 preview_tab->render_view_host()->routing_id(), |
| 63 | 63 GURL(), |
| 64 PluginService::GetInstance()->OverridePluginForTab(plugin); | 64 plugin); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ResetPreviewTabOverrideTitle(TabContentsWrapper* preview_tab) { | 68 void ResetPreviewTabOverrideTitle(TabContentsWrapper* preview_tab) { |
| 69 preview_tab->print_view_manager()->ResetTitleOverride(); | 69 preview_tab->print_view_manager()->ResetTitleOverride(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 namespace printing { | 74 namespace printing { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 RenderProcessHost* rph = tab->render_view_host()->process(); | 379 RenderProcessHost* rph = tab->render_view_host()->process(); |
| 380 if (registrar_.IsRegistered(this, | 380 if (registrar_.IsRegistered(this, |
| 381 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 381 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 382 Source<RenderProcessHost>(rph))) { | 382 Source<RenderProcessHost>(rph))) { |
| 383 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 383 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 384 Source<RenderProcessHost>(rph)); | 384 Source<RenderProcessHost>(rph)); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace printing | 388 } // namespace printing |
| OLD | NEW |