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/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/plugin_prefs.h" | 11 #include "chrome/browser/plugin_prefs.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 14 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
14 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 15 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
16 #include "chrome/common/chrome_content_client.h" | 17 #include "chrome/common/chrome_content_client.h" |
17 #include "chrome/common/jstemplate_builder.h" | 18 #include "chrome/common/jstemplate_builder.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "content/browser/plugin_service.h" | 20 #include "content/browser/plugin_service.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // interstitial. | 149 // interstitial. |
149 plugin.plugin.enabled = WebPluginInfo::USER_ENABLED; | 150 plugin.plugin.enabled = WebPluginInfo::USER_ENABLED; |
150 plugin.plugin.version = ASCIIToUTF16("11.0.0.0"); | 151 plugin.plugin.version = ASCIIToUTF16("11.0.0.0"); |
151 | 152 |
152 PluginService::GetInstance()->OverridePluginForTab(plugin); | 153 PluginService::GetInstance()->OverridePluginForTab(plugin); |
153 tab->render_view_host()->Send(new ViewMsg_ReloadFrame( | 154 tab->render_view_host()->Send(new ViewMsg_ReloadFrame( |
154 tab->render_view_host()->routing_id())); | 155 tab->render_view_host()->routing_id())); |
155 | 156 |
156 if (new_delegate) { | 157 if (new_delegate) { |
157 if (old_delegate) { | 158 if (old_delegate) { |
158 tab->ReplaceInfoBar(old_delegate, new_delegate); | 159 tab->infobar_tab_helper()->ReplaceInfoBar(old_delegate, new_delegate); |
159 } else { | 160 } else { |
160 tab->AddInfoBar(new_delegate); | 161 tab->infobar_tab_helper()->AddInfoBar(new_delegate); |
161 } | 162 } |
162 } | 163 } |
163 } | 164 } |
164 | 165 |
165 // An interstitial to be used when the user chooses to open a PDF using Adobe | 166 // An interstitial to be used when the user chooses to open a PDF using Adobe |
166 // Reader, but it is out of date. | 167 // Reader, but it is out of date. |
167 class PDFUnsupportedFeatureInterstitial : public ChromeInterstitialPage { | 168 class PDFUnsupportedFeatureInterstitial : public ChromeInterstitialPage { |
168 public: | 169 public: |
169 PDFUnsupportedFeatureInterstitial( | 170 PDFUnsupportedFeatureInterstitial( |
170 TabContentsWrapper* tab, | 171 TabContentsWrapper* tab, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 std::vector<PluginGroup> plugin_groups; | 380 std::vector<PluginGroup> plugin_groups; |
380 PluginList::Singleton()->GetPluginGroups( | 381 PluginList::Singleton()->GetPluginGroups( |
381 false, &plugin_groups); | 382 false, &plugin_groups); |
382 for (size_t i = 0; i < plugin_groups.size(); ++i) { | 383 for (size_t i = 0; i < plugin_groups.size(); ++i) { |
383 if (plugin_groups[i].GetGroupName() == reader_group_name) { | 384 if (plugin_groups[i].GetGroupName() == reader_group_name) { |
384 reader_group = &plugin_groups[i]; | 385 reader_group = &plugin_groups[i]; |
385 break; | 386 break; |
386 } | 387 } |
387 } | 388 } |
388 | 389 |
389 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); | 390 tab->infobar_tab_helper()->AddInfoBar( |
| 391 new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); |
390 } | 392 } |
OLD | NEW |