| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pdf_unsupported_feature.h" | 5 #include "chrome/browser/pdf_unsupported_feature.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "base/version.h" | 9 #include "base/version.h" |
| 10 #include "chrome/browser/plugin_updater.h" | 10 #include "chrome/browser/plugin_updater.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 new PDFEnableAdobeReaderInfoBarDelegate(tab_contents_->tab_contents()); | 349 new PDFEnableAdobeReaderInfoBarDelegate(tab_contents_->tab_contents()); |
| 350 OpenUsingReader(tab_contents_, reader_webplugininfo_, this, bar); | 350 OpenUsingReader(tab_contents_, reader_webplugininfo_, this, bar); |
| 351 return false; | 351 return false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL, NULL); | 354 OpenUsingReader(tab_contents_, reader_webplugininfo_, NULL, NULL); |
| 355 return true; | 355 return true; |
| 356 } | 356 } |
| 357 | 357 |
| 358 void PDFUnsupportedFeatureInfoBarDelegate::OnNo() { | 358 void PDFUnsupportedFeatureInfoBarDelegate::OnNo() { |
| 359 UserMetrics::RecordAction(UserMetricsAction(reader_installed_ ? | 359 UserMetrics::RecordAction(reader_installed_ ? |
| 360 "PDF_UseReaderInfoBarCancel" : "PDF_InstallReaderInfoBarCancel")); | 360 UserMetricsAction("PDF_UseReaderInfoBarCancel") : |
| 361 UserMetricsAction("PDF_InstallReaderInfoBarCancel")); |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace | 364 } // namespace |
| 364 | 365 |
| 365 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { | 366 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { |
| 366 #if !defined(OS_WIN) | 367 #if !defined(OS_WIN) |
| 367 // Only works for Windows for now. For Mac, we'll have to launch the file | 368 // Only works for Windows for now. For Mac, we'll have to launch the file |
| 368 // externally since Adobe Reader doesn't work inside Chrome. | 369 // externally since Adobe Reader doesn't work inside Chrome. |
| 369 return; | 370 return; |
| 370 #endif | 371 #endif |
| 371 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); | 372 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); |
| 372 | 373 |
| 373 // If the Reader plugin is disabled by policy, don't prompt them. | 374 // If the Reader plugin is disabled by policy, don't prompt them. |
| 374 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) | 375 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) |
| 375 return; | 376 return; |
| 376 | 377 |
| 377 PluginGroup* reader_group = NULL; | 378 PluginGroup* reader_group = NULL; |
| 378 std::vector<PluginGroup> plugin_groups; | 379 std::vector<PluginGroup> plugin_groups; |
| 379 PluginList::Singleton()->GetPluginGroups( | 380 PluginList::Singleton()->GetPluginGroups( |
| 380 false, &plugin_groups); | 381 false, &plugin_groups); |
| 381 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 382 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
| 382 if (plugin_groups[i].GetGroupName() == reader_group_name) { | 383 if (plugin_groups[i].GetGroupName() == reader_group_name) { |
| 383 reader_group = &plugin_groups[i]; | 384 reader_group = &plugin_groups[i]; |
| 384 break; | 385 break; |
| 385 } | 386 } |
| 386 } | 387 } |
| 387 | 388 |
| 388 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); | 389 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); |
| 389 } | 390 } |
| OLD | NEW |