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_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "printing/features/features.h" | 24 #include "printing/features/features.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
27 | 27 |
28 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManager); | 28 DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManager); |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Keeps track of pending scripted print preview closures. | 32 // Keeps track of pending scripted print preview closures. |
33 // No locking, only access on the UI thread. | 33 // No locking, only access on the UI thread. |
34 base::LazyInstance<std::map<content::RenderProcessHost*, base::Closure>> | 34 base::LazyInstance<std::map<content::RenderProcessHost*, base::Closure>>:: |
35 g_scripted_print_preview_closure_map = LAZY_INSTANCE_INITIALIZER; | 35 DestructorAtExit g_scripted_print_preview_closure_map = |
| 36 LAZY_INSTANCE_INITIALIZER; |
36 | 37 |
37 void EnableInternalPDFPluginForContents(int render_process_id, | 38 void EnableInternalPDFPluginForContents(int render_process_id, |
38 int render_frame_id) { | 39 int render_frame_id) { |
39 // Always enable the internal PDF plugin for the print preview page. | 40 // Always enable the internal PDF plugin for the print preview page. |
40 base::FilePath pdf_plugin_path = base::FilePath::FromUTF8Unsafe( | 41 base::FilePath pdf_plugin_path = base::FilePath::FromUTF8Unsafe( |
41 ChromeContentClient::kPDFPluginPath); | 42 ChromeContentClient::kPDFPluginPath); |
42 | 43 |
43 content::WebPluginInfo pdf_plugin; | 44 content::WebPluginInfo pdf_plugin; |
44 if (!content::PluginService::GetInstance()->GetPluginInfoByPath( | 45 if (!content::PluginService::GetInstance()->GetPluginInfoByPath( |
45 pdf_plugin_path, &pdf_plugin)) { | 46 pdf_plugin_path, &pdf_plugin)) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 IPC_MESSAGE_HANDLER(PrintHostMsg_ShowScriptedPrintPreview, | 249 IPC_MESSAGE_HANDLER(PrintHostMsg_ShowScriptedPrintPreview, |
249 OnShowScriptedPrintPreview) | 250 OnShowScriptedPrintPreview) |
250 IPC_MESSAGE_UNHANDLED(handled = false) | 251 IPC_MESSAGE_UNHANDLED(handled = false) |
251 IPC_END_MESSAGE_MAP() | 252 IPC_END_MESSAGE_MAP() |
252 | 253 |
253 return handled || | 254 return handled || |
254 PrintViewManagerBase::OnMessageReceived(message, render_frame_host); | 255 PrintViewManagerBase::OnMessageReceived(message, render_frame_host); |
255 } | 256 } |
256 | 257 |
257 } // namespace printing | 258 } // namespace printing |
OLD | NEW |