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

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

Issue 7387010: Add PluginServiceFilter interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test Created 9 years, 3 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/infobars/infobar_tab_helper.h" 10 #include "chrome/browser/infobars/infobar_tab_helper.h"
11 #include "chrome/browser/plugin_prefs.h" 11 #include "chrome/browser/plugin_prefs.h"
12 #include "chrome/browser/chrome_plugin_service_filter.h"
12 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" 15 #include "chrome/browser/tab_contents/chrome_interstitial_page.h"
15 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 16 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/common/chrome_content_client.h" 18 #include "chrome/common/chrome_content_client.h"
18 #include "chrome/common/jstemplate_builder.h" 19 #include "chrome/common/jstemplate_builder.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "content/browser/plugin_service.h" 21 #include "content/browser/plugin_service.h"
21 #include "content/browser/renderer_host/render_process_host.h" 22 #include "content/browser/renderer_host/render_process_host.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void OpenReaderUpdateURL(TabContents* tab) { 134 void OpenReaderUpdateURL(TabContents* tab) {
134 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), CURRENT_TAB, 135 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), CURRENT_TAB,
135 PageTransition::LINK); 136 PageTransition::LINK);
136 } 137 }
137 138
138 // Opens the PDF using Adobe Reader. 139 // Opens the PDF using Adobe Reader.
139 void OpenUsingReader(TabContentsWrapper* tab, 140 void OpenUsingReader(TabContentsWrapper* tab,
140 const WebPluginInfo& reader_plugin, 141 const WebPluginInfo& reader_plugin,
141 InfoBarDelegate* old_delegate, 142 InfoBarDelegate* old_delegate,
142 InfoBarDelegate* new_delegate) { 143 InfoBarDelegate* new_delegate) {
143 PluginService::OverriddenPlugin plugin; 144 WebPluginInfo plugin = reader_plugin;
144 plugin.render_process_id = tab->render_view_host()->process()->id();
145 plugin.render_view_id = tab->render_view_host()->routing_id();
146 plugin.url = tab->tab_contents()->GetURL();
147 plugin.plugin = reader_plugin;
148 // The plugin is disabled, so enable it to get around the renderer check. 145 // The plugin is disabled, so enable it to get around the renderer check.
149 // Also give it a new version so that the renderer doesn't show the blocked 146 // Also give it a new version so that the renderer doesn't show the blocked
150 // plugin UI if it's vulnerable, since we already went through the 147 // plugin UI if it's vulnerable, since we already went through the
151 // interstitial. 148 // interstitial.
152 plugin.plugin.enabled = WebPluginInfo::USER_ENABLED; 149 plugin.enabled = WebPluginInfo::USER_ENABLED;
153 plugin.plugin.version = ASCIIToUTF16("11.0.0.0"); 150 plugin.version = ASCIIToUTF16("11.0.0.0");
154 151
155 PluginService::GetInstance()->OverridePluginForTab(plugin); 152 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
153 tab->render_view_host()->process()->id(),
154 tab->render_view_host()->routing_id(),
155 tab->tab_contents()->GetURL(),
156 plugin);
156 tab->render_view_host()->Send(new ViewMsg_ReloadFrame( 157 tab->render_view_host()->Send(new ViewMsg_ReloadFrame(
157 tab->render_view_host()->routing_id())); 158 tab->render_view_host()->routing_id()));
158 159
159 if (new_delegate) { 160 if (new_delegate) {
160 if (old_delegate) { 161 if (old_delegate) {
161 tab->infobar_tab_helper()->ReplaceInfoBar(old_delegate, new_delegate); 162 tab->infobar_tab_helper()->ReplaceInfoBar(old_delegate, new_delegate);
162 } else { 163 } else {
163 tab->infobar_tab_helper()->AddInfoBar(new_delegate); 164 tab->infobar_tab_helper()->AddInfoBar(new_delegate);
164 } 165 }
165 } 166 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return; 380 return;
380 #endif 381 #endif
381 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); 382 string16 reader_group_name(ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName));
382 383
383 // If the Reader plugin is disabled by policy, don't prompt them. 384 // If the Reader plugin is disabled by policy, don't prompt them.
384 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name)) 385 if (PluginGroup::IsPluginNameDisabledByPolicy(reader_group_name))
385 return; 386 return;
386 387
387 PluginGroup* reader_group = NULL; 388 PluginGroup* reader_group = NULL;
388 std::vector<PluginGroup> plugin_groups; 389 std::vector<PluginGroup> plugin_groups;
389 PluginList::Singleton()->GetPluginGroups( 390 PluginList::Singleton()->GetPluginGroups(false, &plugin_groups);
390 false, &plugin_groups);
391 for (size_t i = 0; i < plugin_groups.size(); ++i) { 391 for (size_t i = 0; i < plugin_groups.size(); ++i) {
392 if (plugin_groups[i].GetGroupName() == reader_group_name) { 392 if (plugin_groups[i].GetGroupName() == reader_group_name) {
393 reader_group = &plugin_groups[i]; 393 reader_group = &plugin_groups[i];
394 break; 394 break;
395 } 395 }
396 } 396 }
397 397
398 tab->infobar_tab_helper()->AddInfoBar( 398 tab->infobar_tab_helper()->AddInfoBar(
399 new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group)); 399 new PDFUnsupportedFeatureInfoBarDelegate(tab, reader_group));
400 } 400 }
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