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/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 14 #include "chrome/common/chrome_content_client.h" |
14 #include "chrome/common/jstemplate_builder.h" | 15 #include "chrome/common/jstemplate_builder.h" |
15 #include "chrome/common/pepper_plugin_registry.h" | |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "content/browser/plugin_service.h" | 17 #include "content/browser/plugin_service.h" |
18 #include "content/browser/renderer_host/render_process_host.h" | 18 #include "content/browser/renderer_host/render_process_host.h" |
19 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
20 #include "content/browser/tab_contents/interstitial_page.h" | 20 #include "content/browser/tab_contents/interstitial_page.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
22 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 virtual string16 GetMessageText() const { | 98 virtual string16 GetMessageText() const { |
99 return l10n_util::GetStringUTF16( | 99 return l10n_util::GetStringUTF16( |
100 IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); | 100 IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 bool OnYes() { | 104 bool OnYes() { |
105 UserMetrics::RecordAction( | 105 UserMetrics::RecordAction( |
106 UserMetricsAction("PDF_EnableReaderInfoBarOK")); | 106 UserMetricsAction("PDF_EnableReaderInfoBarOK")); |
107 webkit::npapi::PluginList::Singleton()->EnableGroup( | 107 webkit::npapi::PluginList::Singleton()->EnableGroup( |
108 false, ASCIIToUTF16(PepperPluginRegistry::kPDFPluginName)); | 108 false, ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); |
109 webkit::npapi::PluginList::Singleton()->EnableGroup( | 109 webkit::npapi::PluginList::Singleton()->EnableGroup( |
110 true, ASCIIToUTF16(webkit::npapi::PluginGroup::kAdobeReaderGroupName)); | 110 true, ASCIIToUTF16(webkit::npapi::PluginGroup::kAdobeReaderGroupName)); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 bool OnNo() { | 114 bool OnNo() { |
115 UserMetrics::RecordAction( | 115 UserMetrics::RecordAction( |
116 UserMetricsAction("PDF_EnableReaderInfoBarCancel")); | 116 UserMetricsAction("PDF_EnableReaderInfoBarCancel")); |
117 return true; | 117 return true; |
118 } | 118 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 382 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
383 if (plugin_groups[i].GetGroupName() == reader_group_name) { | 383 if (plugin_groups[i].GetGroupName() == reader_group_name) { |
384 reader_group = &plugin_groups[i]; | 384 reader_group = &plugin_groups[i]; |
385 break; | 385 break; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 tab->AddInfoBar(new PDFUnsupportedFeatureConfirmInfoBarDelegate( | 389 tab->AddInfoBar(new PDFUnsupportedFeatureConfirmInfoBarDelegate( |
390 tab, reader_group)); | 390 tab, reader_group)); |
391 } | 391 } |
OLD | NEW |