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

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

Issue 11364202: Get full WebPluginInfo for the PDF plug-in before enabling it for print preview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix? Created 8 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
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_tab_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 #include "chrome/common/chrome_content_client.h" 30 #include "chrome/common/chrome_content_client.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/url_constants.h" 34 #include "chrome/common/url_constants.h"
35 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
36 #include "content/public/browser/navigation_details.h" 36 #include "content/public/browser/navigation_details.h"
37 #include "content/public/browser/navigation_entry.h" 37 #include "content/public/browser/navigation_entry.h"
38 #include "content/public/browser/notification_details.h" 38 #include "content/public/browser/notification_details.h"
39 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/plugin_service.h"
40 #include "content/public/browser/render_process_host.h" 41 #include "content/public/browser/render_process_host.h"
41 #include "content/public/browser/render_view_host.h" 42 #include "content/public/browser/render_view_host.h"
42 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
43 #include "content/public/browser/web_contents_delegate.h" 44 #include "content/public/browser/web_contents_delegate.h"
44 #include "ui/web_dialogs/web_dialog_delegate.h" 45 #include "ui/web_dialogs/web_dialog_delegate.h"
45 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 46 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
46 #include "webkit/plugins/webplugininfo.h" 47 #include "webkit/plugins/webplugininfo.h"
47 48
48 using content::NativeWebKeyboardEvent; 49 using content::NativeWebKeyboardEvent;
49 using content::NavigationController; 50 using content::NavigationController;
50 using content::WebContents; 51 using content::WebContents;
51 using content::WebUIMessageHandler; 52 using content::WebUIMessageHandler;
52 using ui::WebDialogDelegate; 53 using ui::WebDialogDelegate;
53 using ui::WebDialogWebContentsDelegate; 54 using ui::WebDialogWebContentsDelegate;
54 55
55 namespace { 56 namespace {
56 57
57 void EnableInternalPDFPluginForTab(TabContents* preview_tab) { 58 void EnableInternalPDFPluginForTab(TabContents* preview_tab) {
58 // Always enable the internal PDF plugin for the print preview page. 59 // Always enable the internal PDF plugin for the print preview page.
60 FilePath pdf_plugin_path;
61 if (!PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin_path))
62 return;
63
59 webkit::WebPluginInfo pdf_plugin; 64 webkit::WebPluginInfo pdf_plugin;
60 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin.path); 65 if (!content::PluginService::GetInstance()->GetPluginInfoByPath(
66 pdf_plugin_path, &pdf_plugin)) {
67 return;
68 }
61 69
62 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( 70 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
63 preview_tab->web_contents()->GetRenderProcessHost()->GetID(), 71 preview_tab->web_contents()->GetRenderProcessHost()->GetID(),
64 preview_tab->web_contents()->GetRenderViewHost()->GetRoutingID(), 72 preview_tab->web_contents()->GetRenderViewHost()->GetRoutingID(),
65 GURL(), pdf_plugin); 73 GURL(), pdf_plugin);
66 } 74 }
67 75
68 // WebDialogDelegate that specifies what the print preview dialog 76 // WebDialogDelegate that specifies what the print preview dialog
69 // will look like. 77 // will look like.
70 class PrintPreviewTabDelegate : public WebDialogDelegate { 78 class PrintPreviewTabDelegate : public WebDialogDelegate {
71 public: 79 public:
72 explicit PrintPreviewTabDelegate(TabContents* initiator_tab); 80 explicit PrintPreviewTabDelegate(TabContents* initiator_tab);
73 virtual ~PrintPreviewTabDelegate(); 81 virtual ~PrintPreviewTabDelegate();
74 82
75 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 83 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 544 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
537 preview_tab->web_contents()->GetWebUI()->GetController()); 545 preview_tab->web_contents()->GetWebUI()->GetController());
538 if (print_preview_ui) 546 if (print_preview_ui)
539 print_preview_ui->OnTabDestroyed(); 547 print_preview_ui->OnTabDestroyed();
540 548
541 preview_tab_map_.erase(preview_tab); 549 preview_tab_map_.erase(preview_tab);
542 RemoveObservers(preview_tab); 550 RemoveObservers(preview_tab);
543 } 551 }
544 552
545 } // namespace printing 553 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_tab_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698