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