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

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

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
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/ui/pdf/pdf_unsupported_feature.h" 5 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "base/version.h" 10 #include "base/version.h"
11 #include "chrome/browser/chrome_plugin_service_filter.h" 11 #include "chrome/browser/chrome_plugin_service_filter.h"
12 #include "chrome/browser/infobars/infobar_tab_helper.h" 12 #include "chrome/browser/infobars/infobar_tab_helper.h"
13 #include "chrome/browser/plugin_prefs.h" 13 #include "chrome/browser/plugin_prefs.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" 16 #include "chrome/browser/tab_contents/chrome_interstitial_page.h"
17 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 17 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
18 #include "chrome/browser/tab_contents/tab_util.h" 18 #include "chrome/browser/tab_contents/tab_util.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/common/chrome_content_client.h" 20 #include "chrome/common/chrome_content_client.h"
21 #include "chrome/common/jstemplate_builder.h" 21 #include "chrome/common/jstemplate_builder.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "content/browser/plugin_service.h" 23 #include "content/browser/plugin_service.h"
24 #include "content/browser/renderer_host/render_view_host.h" 24 #include "content/browser/renderer_host/render_view_host.h"
25 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/browser/user_metrics.h" 26 #include "content/browser/user_metrics.h"
26 #include "grit/browser_resources.h" 27 #include "grit/browser_resources.h"
27 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
28 #include "grit/theme_resources_standard.h" 29 #include "grit/theme_resources_standard.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/image/image.h" 32 #include "ui/gfx/image/image.h"
32 #include "webkit/plugins/npapi/plugin_group.h" 33 #include "webkit/plugins/npapi/plugin_group.h"
33 34
34 using webkit::npapi::PluginGroup; 35 using webkit::npapi::PluginGroup;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), NEW_FOREGROUND_TAB, 130 tab->OpenURL(GURL(kReaderUpdateUrl), GURL(), NEW_FOREGROUND_TAB,
130 content::PAGE_TRANSITION_LINK); 131 content::PAGE_TRANSITION_LINK);
131 } 132 }
132 133
133 // Opens the PDF using Adobe Reader. 134 // Opens the PDF using Adobe Reader.
134 void OpenUsingReader(TabContentsWrapper* tab, 135 void OpenUsingReader(TabContentsWrapper* tab,
135 const WebPluginInfo& reader_plugin, 136 const WebPluginInfo& reader_plugin,
136 InfoBarDelegate* old_delegate, 137 InfoBarDelegate* old_delegate,
137 InfoBarDelegate* new_delegate) { 138 InfoBarDelegate* new_delegate) {
138 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( 139 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
139 tab->render_view_host()->process()->GetID(), 140 tab->tab_contents()->render_view_host()->process()->GetID(),
140 tab->render_view_host()->routing_id(), 141 tab->tab_contents()->render_view_host()->routing_id(),
141 tab->tab_contents()->GetURL(), 142 tab->tab_contents()->GetURL(),
142 ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); 143 ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName));
143 tab->render_view_host()->ReloadFrame(); 144 tab->tab_contents()->render_view_host()->ReloadFrame();
144 145
145 if (new_delegate) { 146 if (new_delegate) {
146 if (old_delegate) { 147 if (old_delegate) {
147 tab->infobar_tab_helper()->ReplaceInfoBar(old_delegate, new_delegate); 148 tab->infobar_tab_helper()->ReplaceInfoBar(old_delegate, new_delegate);
148 } else { 149 } else {
149 tab->infobar_tab_helper()->AddInfoBar(new_delegate); 150 tab->infobar_tab_helper()->AddInfoBar(new_delegate);
150 } 151 }
151 } 152 }
152 } 153 }
153 154
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 396
396 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { 397 void PDFHasUnsupportedFeature(TabContentsWrapper* tab) {
397 #if !defined(OS_WIN) 398 #if !defined(OS_WIN)
398 // Only works for Windows for now. For Mac, we'll have to launch the file 399 // Only works for Windows for now. For Mac, we'll have to launch the file
399 // externally since Adobe Reader doesn't work inside Chrome. 400 // externally since Adobe Reader doesn't work inside Chrome.
400 return; 401 return;
401 #endif 402 #endif
402 403
403 PluginService::GetInstance()->GetPluginGroups( 404 PluginService::GetInstance()->GetPluginGroups(
404 base::Bind(&GotPluginGroupsCallback, 405 base::Bind(&GotPluginGroupsCallback,
405 tab->render_view_host()->process()->GetID(), 406 tab->tab_contents()->render_view_host()->process()->GetID(),
406 tab->render_view_host()->routing_id())); 407 tab->tab_contents()->render_view_host()->routing_id()));
407 } 408 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/login/login_prompt_browsertest.cc ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698