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

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

Issue 10993016: Override plug-ins by path instead of name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 2 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) 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
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/path_service.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chrome_plugin_service_filter.h" 16 #include "chrome/browser/chrome_plugin_service_filter.h"
16 #include "chrome/browser/printing/print_view_manager.h" 17 #include "chrome/browser/printing/print_view_manager.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 20 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_navigator.h" 21 #include "chrome/browser/ui/browser_navigator.h"
21 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 23 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
23 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 24 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents.h"
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" 26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
26 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 27 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
27 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 28 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
28 #include "chrome/common/chrome_content_client.h" 29 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
32 #include "content/public/browser/navigation_controller.h" 34 #include "content/public/browser/navigation_controller.h"
33 #include "content/public/browser/navigation_details.h" 35 #include "content/public/browser/navigation_details.h"
34 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 37 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_source.h" 38 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/render_process_host.h" 39 #include "content/public/browser/render_process_host.h"
38 #include "content/public/browser/render_view_host.h" 40 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_contents_delegate.h" 42 #include "content/public/browser/web_contents_delegate.h"
41 #include "ui/web_dialogs/constrained_web_dialog_ui.h" 43 #include "ui/web_dialogs/constrained_web_dialog_ui.h"
42 #include "ui/web_dialogs/web_dialog_delegate.h" 44 #include "ui/web_dialogs/web_dialog_delegate.h"
43 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 45 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
44 #include "webkit/plugins/webplugininfo.h" 46 #include "webkit/plugins/webplugininfo.h"
45 47
46 using content::NativeWebKeyboardEvent; 48 using content::NativeWebKeyboardEvent;
47 using content::NavigationController; 49 using content::NavigationController;
48 using content::WebContents; 50 using content::WebContents;
49 using content::WebUIMessageHandler; 51 using content::WebUIMessageHandler;
50 using ui::ConstrainedWebDialogDelegate; 52 using ui::ConstrainedWebDialogDelegate;
51 using ui::WebDialogDelegate; 53 using ui::WebDialogDelegate;
52 using ui::WebDialogWebContentsDelegate; 54 using ui::WebDialogWebContentsDelegate;
53 55
54 namespace { 56 namespace {
55 57
56 void EnableInternalPDFPluginForTab(TabContents* preview_tab) { 58 void EnableInternalPDFPluginForTab(TabContents* preview_tab) {
57 // Always enable the internal PDF plugin for the print preview page. 59 // Always enable the internal PDF plugin for the print preview page.
60 webkit::WebPluginInfo pdf_plugin;
61 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin.path);
62
58 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( 63 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
59 preview_tab->web_contents()->GetRenderProcessHost()->GetID(), 64 preview_tab->web_contents()->GetRenderProcessHost()->GetID(),
60 preview_tab->web_contents()->GetRenderViewHost()->GetRoutingID(), 65 preview_tab->web_contents()->GetRenderViewHost()->GetRoutingID(),
61 GURL(), 66 GURL(), pdf_plugin);
62 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName));
63 } 67 }
64 68
65 // WebDialogDelegate that specifies what the print preview dialog 69 // WebDialogDelegate that specifies what the print preview dialog
66 // will look like. 70 // will look like.
67 class PrintPreviewTabDelegate : public WebDialogDelegate { 71 class PrintPreviewTabDelegate : public WebDialogDelegate {
68 public: 72 public:
69 explicit PrintPreviewTabDelegate(TabContents* initiator_tab); 73 explicit PrintPreviewTabDelegate(TabContents* initiator_tab);
70 virtual ~PrintPreviewTabDelegate(); 74 virtual ~PrintPreviewTabDelegate();
71 75
72 virtual ui::ModalType GetDialogModalType() const OVERRIDE; 76 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 535 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
532 preview_tab->web_contents()->GetWebUI()->GetController()); 536 preview_tab->web_contents()->GetWebUI()->GetController());
533 if (print_preview_ui) 537 if (print_preview_ui)
534 print_preview_ui->OnTabDestroyed(); 538 print_preview_ui->OnTabDestroyed();
535 539
536 preview_tab_map_.erase(preview_tab); 540 preview_tab_map_.erase(preview_tab);
537 RemoveObservers(preview_tab); 541 RemoveObservers(preview_tab);
538 } 542 }
539 543
540 } // namespace printing 544 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/chrome_plugin_service_filter.cc ('k') | chrome/browser/ui/pdf/pdf_unsupported_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698