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

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

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 years, 3 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_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_list.h"
33 #include "webkit/plugins/webplugininfo.h"
34 32
35 using webkit::npapi::PluginGroup; 33 using webkit::npapi::PluginGroup;
36 using webkit::npapi::PluginList;
37 using webkit::WebPluginInfo; 34 using webkit::WebPluginInfo;
38 35
39 namespace { 36 namespace {
40 37
41 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { 38 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) {
42 // Always enable the internal PDF plugin for the print preview page. 39 // Always enable the internal PDF plugin for the print preview page.
43 string16 internal_pdf_group_name( 40 string16 internal_pdf_group_name(
44 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); 41 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName));
45 PluginGroup* internal_pdf_group = NULL; 42 PluginGroup* internal_pdf_group = NULL;
46 std::vector<PluginGroup> plugin_groups; 43 std::vector<PluginGroup> plugin_groups;
47 PluginList::Singleton()->GetPluginGroups(false, &plugin_groups); 44 PluginService::GetInstance()->GetCachedPluginGroups(&plugin_groups);
48 for (size_t i = 0; i < plugin_groups.size(); ++i) { 45 for (size_t i = 0; i < plugin_groups.size(); ++i) {
49 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) { 46 if (plugin_groups[i].GetGroupName() == internal_pdf_group_name) {
50 internal_pdf_group = &plugin_groups[i]; 47 internal_pdf_group = &plugin_groups[i];
51 break; 48 break;
52 } 49 }
53 } 50 }
54 if (internal_pdf_group) { 51 if (internal_pdf_group) {
55 const std::vector<WebPluginInfo>& plugins = 52 const std::vector<WebPluginInfo>& plugins =
56 internal_pdf_group->web_plugin_infos(); 53 internal_pdf_group->web_plugin_infos();
57 DCHECK_EQ(plugins.size(), 1U); 54 DCHECK_EQ(plugins.size(), 1U);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 RenderProcessHost* rph = tab->render_view_host()->process(); 386 RenderProcessHost* rph = tab->render_view_host()->process();
390 if (registrar_.IsRegistered(this, 387 if (registrar_.IsRegistered(this,
391 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 388 content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
392 Source<RenderProcessHost>(rph))) { 389 Source<RenderProcessHost>(rph))) {
393 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 390 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
394 Source<RenderProcessHost>(rph)); 391 Source<RenderProcessHost>(rph));
395 } 392 }
396 } 393 }
397 394
398 } // namespace printing 395 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698