| 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/chrome_plugin_service_filter.h" |
| 13 #include "chrome/browser/printing/print_view_manager.h" | 13 #include "chrome/browser/printing/print_view_manager.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/sessions/restore_tab_helper.h" | 15 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 16 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_navigator.h" | 19 #include "chrome/browser/ui/browser_navigator.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 21 #include "chrome/browser/ui/webui/print_preview_ui.h" | 21 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 22 #include "chrome/common/chrome_content_client.h" | 22 #include "chrome/common/chrome_content_client.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "content/browser/plugin_service.h" |
| 25 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
| 26 #include "content/browser/tab_contents/navigation_details.h" | 27 #include "content/browser/tab_contents/navigation_details.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 28 #include "content/common/content_notification_types.h" | 29 #include "content/common/content_notification_types.h" |
| 29 #include "content/common/notification_details.h" | 30 #include "content/common/notification_details.h" |
| 30 #include "content/common/notification_source.h" | 31 #include "content/common/notification_source.h" |
| 31 #include "webkit/plugins/npapi/plugin_group.h" | 32 #include "webkit/plugins/npapi/plugin_group.h" |
| 32 #include "webkit/plugins/npapi/plugin_list.h" | |
| 33 #include "webkit/plugins/webplugininfo.h" | |
| 34 | 33 |
| 35 using webkit::npapi::PluginGroup; | 34 using webkit::npapi::PluginGroup; |
| 36 using webkit::npapi::PluginList; | |
| 37 using webkit::WebPluginInfo; | 35 using webkit::WebPluginInfo; |
| 38 | 36 |
| 39 namespace { | 37 namespace { |
| 40 | 38 |
| 41 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { | 39 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { |
| 42 // Always enable the internal PDF plugin for the print preview page. | 40 // Always enable the internal PDF plugin for the print preview page. |
| 43 string16 internal_pdf_group_name( | 41 string16 internal_pdf_group_name( |
| 44 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); | 42 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); |
| 45 PluginGroup* internal_pdf_group = NULL; | 43 PluginGroup* internal_pdf_group = NULL; |
| 46 std::vector<PluginGroup> plugin_groups; | 44 std::vector<PluginGroup> plugin_groups; |
| 47 PluginList::Singleton()->GetPluginGroups(false, &plugin_groups); | 45 PluginService::GetInstance()->GetCachedPluginGroups(&plugin_groups); |
| 48 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 46 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
| 49 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) { | 47 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) { |
| 50 internal_pdf_group = &plugin_groups[i]; | 48 internal_pdf_group = &plugin_groups[i]; |
| 51 break; | 49 break; |
| 52 } | 50 } |
| 53 } | 51 } |
| 54 if (internal_pdf_group) { | 52 if (internal_pdf_group) { |
| 55 const std::vector<WebPluginInfo>& plugins = | 53 const std::vector<WebPluginInfo>& plugins = |
| 56 internal_pdf_group->web_plugin_infos(); | 54 internal_pdf_group->web_plugin_infos(); |
| 57 DCHECK_EQ(plugins.size(), 1U); | 55 DCHECK_EQ(plugins.size(), 1U); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 RenderProcessHost* rph = tab->render_view_host()->process(); | 387 RenderProcessHost* rph = tab->render_view_host()->process(); |
| 390 if (registrar_.IsRegistered(this, | 388 if (registrar_.IsRegistered(this, |
| 391 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 389 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 392 Source<RenderProcessHost>(rph))) { | 390 Source<RenderProcessHost>(rph))) { |
| 393 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 391 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 394 Source<RenderProcessHost>(rph)); | 392 Source<RenderProcessHost>(rph)); |
| 395 } | 393 } |
| 396 } | 394 } |
| 397 | 395 |
| 398 } // namespace printing | 396 } // namespace printing |
| OLD | NEW |