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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL); | 358 OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL); |
359 } | 359 } |
360 | 360 |
361 void PDFUnsupportedFeaturePromptDelegate::Cancel() { | 361 void PDFUnsupportedFeaturePromptDelegate::Cancel() { |
362 content::RecordAction(reader_installed_ ? | 362 content::RecordAction(reader_installed_ ? |
363 UserMetricsAction("PDF_UseReaderInfoBarCancel") : | 363 UserMetricsAction("PDF_UseReaderInfoBarCancel") : |
364 UserMetricsAction("PDF_InstallReaderInfoBarCancel")); | 364 UserMetricsAction("PDF_InstallReaderInfoBarCancel")); |
365 } | 365 } |
366 | 366 |
| 367 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) |
367 void GotPluginsCallback(int process_id, | 368 void GotPluginsCallback(int process_id, |
368 int routing_id, | 369 int routing_id, |
369 const std::vector<webkit::WebPluginInfo>& plugins) { | 370 const std::vector<webkit::WebPluginInfo>& plugins) { |
370 WebContents* web_contents = | 371 WebContents* web_contents = |
371 tab_util::GetWebContentsByID(process_id, routing_id); | 372 tab_util::GetWebContentsByID(process_id, routing_id); |
372 if (!web_contents) | 373 if (!web_contents) |
373 return; | 374 return; |
374 | 375 |
375 TabContents* tab = TabContents::FromWebContents(web_contents); | 376 TabContents* tab = TabContents::FromWebContents(web_contents); |
376 if (!tab) | 377 if (!tab) |
(...skipping 16 matching lines...) Expand all Loading... |
393 return; | 394 return; |
394 } | 395 } |
395 break; | 396 break; |
396 } | 397 } |
397 | 398 |
398 scoped_ptr<OpenPDFInReaderPromptDelegate> prompt( | 399 scoped_ptr<OpenPDFInReaderPromptDelegate> prompt( |
399 new PDFUnsupportedFeaturePromptDelegate(tab, reader, plugin_finder)); | 400 new PDFUnsupportedFeaturePromptDelegate(tab, reader, plugin_finder)); |
400 PDFTabHelper* pdf_tab_helper = PDFTabHelper::FromWebContents(web_contents); | 401 PDFTabHelper* pdf_tab_helper = PDFTabHelper::FromWebContents(web_contents); |
401 pdf_tab_helper->ShowOpenInReaderPrompt(prompt.Pass()); | 402 pdf_tab_helper->ShowOpenInReaderPrompt(prompt.Pass()); |
402 } | 403 } |
| 404 #endif // defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) |
403 | 405 |
404 } // namespace | 406 } // namespace |
405 | 407 |
406 void PDFHasUnsupportedFeature(content::WebContents* web_contents) { | 408 void PDFHasUnsupportedFeature(content::WebContents* web_contents) { |
407 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) | 409 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) |
408 // Only works for Windows for now. For Mac, we'll have to launch the file | 410 // Only works for Windows for now. For Mac, we'll have to launch the file |
409 // externally since Adobe Reader doesn't work inside Chrome. | 411 // externally since Adobe Reader doesn't work inside Chrome. |
410 PluginService::GetInstance()->GetPlugins(base::Bind(&GotPluginsCallback, | 412 PluginService::GetInstance()->GetPlugins(base::Bind(&GotPluginsCallback, |
411 web_contents->GetRenderProcessHost()->GetID(), | 413 web_contents->GetRenderProcessHost()->GetID(), |
412 web_contents->GetRenderViewHost()->GetRoutingID())); | 414 web_contents->GetRenderViewHost()->GetRoutingID())); |
413 #endif | 415 #endif |
414 } | 416 } |
OLD | NEW |