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 if (reader_installed_) { |
James Hawkins
2011/07/07 16:30:50
What's wrong with this version?
Ilya Sherman
2011/07/07 18:59:44
This script scans for the literal string """ UserM
James Hawkins
2011/07/07 20:44:19
Yea, I think I prefer that. It's at least in the s
Ilya Sherman
2011/07/07 21:01:01
Ok, switched to that style.
| |
353 "PDF_UseReaderInfoBarCancel" : "PDF_InstallReaderInfoBarCancel")); | 353 UserMetrics::RecordAction(UserMetricsAction("PDF_UseReaderInfoBarCancel")); |
354 } else { | |
355 UserMetrics::RecordAction( | |
356 UserMetricsAction("PDF_InstallReaderInfoBarCancel")); | |
357 } | |
354 } | 358 } |
355 | 359 |
356 } // namespace | 360 } // namespace |
357 | 361 |
358 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { | 362 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { |
359 #if !defined(OS_WIN) | 363 #if !defined(OS_WIN) |
360 // Only works for Windows for now. For Mac, we'll have to launch the file | 364 // 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. | 365 // externally since Adobe Reader doesn't work inside Chrome. |
362 return; | 366 return; |
363 #endif | 367 #endif |
364 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); | 368 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); |
365 | 369 |
366 // If the Reader plugin is disabled by policy, don't prompt them. | 370 // If the Reader plugin is disabled by policy, don't prompt them. |
367 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) | 371 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) |
368 return; | 372 return; |
369 | 373 |
370 PluginGroup* reader_group = NULL; | 374 PluginGroup* reader_group = NULL; |
371 std::vector<PluginGroup> plugin_groups; | 375 std::vector<PluginGroup> plugin_groups; |
372 PluginList::Singleton()->GetPluginGroups( | 376 PluginList::Singleton()->GetPluginGroups( |
373 false, &plugin_groups); | 377 false, &plugin_groups); |
374 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 378 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
375 if (plugin_groups[i].GetGroupName() == reader_group_name) { | 379 if (plugin_groups[i].GetGroupName() == reader_group_name) { |
376 reader_group = &plugin_groups[i]; | 380 reader_group = &plugin_groups[i]; |
377 break; | 381 break; |
378 } | 382 } |
379 } | 383 } |
380 | 384 |
381 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); | 385 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); |
382 } | 386 } |
OLD | NEW |