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/ui/pdf/pdf_unsupported_feature.h" | 5 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
13 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
14 #include "chrome/browser/plugins/plugin_metadata.h" | 16 #include "chrome/browser/plugins/plugin_metadata.h" |
15 #include "chrome/browser/plugins/plugin_prefs.h" | 17 #include "chrome/browser/plugins/plugin_prefs.h" |
16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 void MaybeShowOpenPDFInReaderPrompt(WebContents* web_contents, | 322 void MaybeShowOpenPDFInReaderPrompt(WebContents* web_contents, |
321 const AdobeReaderPluginInfo& reader_info) { | 323 const AdobeReaderPluginInfo& reader_info) { |
322 // If the Reader plugin is disabled by policy, don't prompt them. | 324 // If the Reader plugin is disabled by policy, don't prompt them. |
323 if (!reader_info.is_installed || !reader_info.is_enabled) | 325 if (!reader_info.is_installed || !reader_info.is_enabled) |
324 return; | 326 return; |
325 | 327 |
326 scoped_ptr<pdf::OpenPDFInReaderPromptClient> prompt( | 328 scoped_ptr<pdf::OpenPDFInReaderPromptClient> prompt( |
327 new PDFUnsupportedFeaturePromptClient(web_contents, reader_info)); | 329 new PDFUnsupportedFeaturePromptClient(web_contents, reader_info)); |
328 pdf::PDFWebContentsHelper* pdf_tab_helper = | 330 pdf::PDFWebContentsHelper* pdf_tab_helper = |
329 pdf::PDFWebContentsHelper::FromWebContents(web_contents); | 331 pdf::PDFWebContentsHelper::FromWebContents(web_contents); |
330 pdf_tab_helper->ShowOpenInReaderPrompt(prompt.Pass()); | 332 pdf_tab_helper->ShowOpenInReaderPrompt(std::move(prompt)); |
331 } | 333 } |
332 | 334 |
333 void GotPluginsCallback(int process_id, | 335 void GotPluginsCallback(int process_id, |
334 int routing_id, | 336 int routing_id, |
335 const AdobeReaderPluginInfo& reader_info) { | 337 const AdobeReaderPluginInfo& reader_info) { |
336 WebContents* web_contents = | 338 WebContents* web_contents = |
337 tab_util::GetWebContentsByID(process_id, routing_id); | 339 tab_util::GetWebContentsByID(process_id, routing_id); |
338 if (web_contents) | 340 if (web_contents) |
339 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); | 341 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); |
340 } | 342 } |
(...skipping 12 matching lines...) Expand all Loading... |
353 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); | 355 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); |
354 return; | 356 return; |
355 } | 357 } |
356 GetAdobeReaderPluginInfoAsync( | 358 GetAdobeReaderPluginInfoAsync( |
357 profile, | 359 profile, |
358 base::Bind(&GotPluginsCallback, | 360 base::Bind(&GotPluginsCallback, |
359 web_contents->GetRenderProcessHost()->GetID(), | 361 web_contents->GetRenderProcessHost()->GetID(), |
360 web_contents->GetRenderViewHost()->GetRoutingID())); | 362 web_contents->GetRenderViewHost()->GetRoutingID())); |
361 #endif // defined(OS_WIN) | 363 #endif // defined(OS_WIN) |
362 } | 364 } |
OLD | NEW |