Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Side by Side Diff: chrome/browser/pdf_unsupported_feature.cc

Issue 7477044: Use PluginPrefs in ChromePluginServiceFilter to check whether a plugin is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/plugin_data_remover.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_prefs.h" 10 #include "chrome/browser/plugin_prefs.h"
11 #include "chrome/browser/chrome_plugin_service_filter.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
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 WebPluginInfo plugin = reader_plugin;
141 plugin.render_process_id = tab->render_view_host()->process()->id();
142 plugin.render_view_id = tab->render_view_host()->routing_id();
143 plugin.url = tab->tab_contents()->GetURL();
144 plugin.plugin = reader_plugin;
145 // The plugin is disabled, so enable it to get around the renderer check. 142 // 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 143 // 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 144 // plugin UI if it's vulnerable, since we already went through the
148 // interstitial. 145 // interstitial.
149 plugin.plugin.enabled = WebPluginInfo::USER_ENABLED; 146 plugin.enabled = WebPluginInfo::USER_ENABLED;
150 plugin.plugin.version = ASCIIToUTF16("11.0.0.0"); 147 plugin.version = ASCIIToUTF16("11.0.0.0");
151 148
152 PluginService::GetInstance()->OverridePluginForTab(plugin); 149 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
150 tab->render_view_host()->process()->id(),
151 tab->render_view_host()->routing_id(),
152 tab->tab_contents()->GetURL(),
153 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return; 371 return;
371 #endif 372 #endif
372 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); 373 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName));
373 374
374 // If the Reader plugin is disabled by policy, don't prompt them. 375 // If the Reader plugin is disabled by policy, don't prompt them.
375 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) 376 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name))
376 return; 377 return;
377 378
378 PluginGroup* reader_group = NULL; 379 PluginGroup* reader_group = NULL;
379 std::vector<PluginGroup> plugin_groups; 380 std::vector<PluginGroup> plugin_groups;
380 PluginList::Singleton()->GetPluginGroups( 381 PluginList::Singleton()->GetPluginGroups(false, &plugin_groups);
381 false, &plugin_groups);
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 PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); 389 tab->AddInfoBar(new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group));
390 } 390 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/plugin_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698