| 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" |
| 11 #include "chrome/browser/chrome_plugin_service_helper.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" |
| 20 #include "content/browser/renderer_host/render_process_host.h" | 21 #include "content/browser/renderer_host/render_process_host.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void OpenReaderUpdateURL(TabContents* tab) { | 131 void OpenReaderUpdateURL(TabContents* tab) { |
| 131 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), CURRENT_TAB, | 132 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), CURRENT_TAB, |
| 132 PageTransition::LINK); | 133 PageTransition::LINK); |
| 133 } | 134 } |
| 134 | 135 |
| 135 // Opens the PDF using Adobe Reader. | 136 // Opens the PDF using Adobe Reader. |
| 136 void OpenUsingReader(TabContentsWrapper* tab, | 137 void OpenUsingReader(TabContentsWrapper* tab, |
| 137 const WebPluginInfo& reader_plugin, | 138 const WebPluginInfo& reader_plugin, |
| 138 InfoBarDelegate* old_delegate, | 139 InfoBarDelegate* old_delegate, |
| 139 InfoBarDelegate* new_delegate) { | 140 InfoBarDelegate* new_delegate) { |
| 140 PluginService::OverriddenPlugin plugin; | 141 ChromePluginServiceHelper::OverriddenPlugin plugin; |
| 141 plugin.render_process_id = tab->render_view_host()->process()->id(); | 142 plugin.render_process_id = tab->render_view_host()->process()->id(); |
| 142 plugin.render_view_id = tab->render_view_host()->routing_id(); | 143 plugin.render_view_id = tab->render_view_host()->routing_id(); |
| 143 plugin.url = tab->tab_contents()->GetURL(); | 144 plugin.url = tab->tab_contents()->GetURL(); |
| 144 plugin.plugin = reader_plugin; | 145 plugin.plugin = reader_plugin; |
| 145 // The plugin is disabled, so enable it to get around the renderer check. | 146 // The plugin is disabled, so enable it to get around the renderer check. |
| 146 // Also give it a new version so that the renderer doesn't show the blocked | 147 // Also give it a new version so that the renderer doesn't show the blocked |
| 147 // plugin UI if it's vulnerable, since we already went through the | 148 // plugin UI if it's vulnerable, since we already went through the |
| 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 ChromePluginServiceHelper::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->ReplaceInfoBar(old_delegate, new_delegate); |
| 159 } else { | 160 } else { |
| 160 tab->AddInfoBar(new_delegate); | 161 tab->AddInfoBar(new_delegate); |
| 161 } | 162 } |
| 162 } | 163 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |