OLD | NEW |
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_dialog_controller.h" | 5 #include "chrome/browser/printing/print_preview_dialog_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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "ui/web_dialogs/web_dialog_delegate.h" | 45 #include "ui/web_dialogs/web_dialog_delegate.h" |
46 | 46 |
47 using content::NavigationController; | 47 using content::NavigationController; |
48 using content::WebContents; | 48 using content::WebContents; |
49 using content::WebUIMessageHandler; | 49 using content::WebUIMessageHandler; |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 void EnableInternalPDFPluginForContents(WebContents* preview_dialog) { | 53 void EnableInternalPDFPluginForContents(WebContents* preview_dialog) { |
54 // Always enable the internal PDF plugin for the print preview page. | 54 // Always enable the internal PDF plugin for the print preview page. |
55 base::FilePath pdf_plugin_path = base::FilePath::FromUTF8Unsafe( | 55 base::FilePath pdf_plugin_path; |
56 ChromeContentClient::kPDFPluginPath); | 56 if (!PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin_path)) |
| 57 return; |
57 | 58 |
58 content::WebPluginInfo pdf_plugin; | 59 content::WebPluginInfo pdf_plugin; |
59 if (!content::PluginService::GetInstance()->GetPluginInfoByPath( | 60 if (!content::PluginService::GetInstance()->GetPluginInfoByPath( |
60 pdf_plugin_path, &pdf_plugin)) | 61 pdf_plugin_path, &pdf_plugin)) |
61 return; | 62 return; |
62 | 63 |
63 ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame( | 64 ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame( |
64 preview_dialog->GetRenderProcessHost()->GetID(), | 65 preview_dialog->GetRenderProcessHost()->GetID(), |
65 preview_dialog->GetMainFrame()->GetRoutingID(), | 66 preview_dialog->GetMainFrame()->GetRoutingID(), |
66 GURL(), pdf_plugin); | 67 GURL(), pdf_plugin); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 static_cast<PrintPreviewUI*>(web_ui->GetController()); | 489 static_cast<PrintPreviewUI*>(web_ui->GetController()); |
489 if (print_preview_ui) | 490 if (print_preview_ui) |
490 print_preview_ui->OnPrintPreviewDialogDestroyed(); | 491 print_preview_ui->OnPrintPreviewDialogDestroyed(); |
491 } | 492 } |
492 | 493 |
493 preview_dialog_map_.erase(preview_dialog); | 494 preview_dialog_map_.erase(preview_dialog); |
494 RemoveObservers(preview_dialog); | 495 RemoveObservers(preview_dialog); |
495 } | 496 } |
496 | 497 |
497 } // namespace printing | 498 } // namespace printing |
OLD | NEW |