OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 Profile* profile) | 80 Profile* profile) |
81 : profile_(profile) { | 81 : profile_(profile) { |
82 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarShown")); | 82 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarShown")); |
83 } | 83 } |
84 | 84 |
85 PDFEnableAdobeReaderPromptClient::~PDFEnableAdobeReaderPromptClient() { | 85 PDFEnableAdobeReaderPromptClient::~PDFEnableAdobeReaderPromptClient() { |
86 } | 86 } |
87 | 87 |
88 bool PDFEnableAdobeReaderPromptClient::ShouldExpire( | 88 bool PDFEnableAdobeReaderPromptClient::ShouldExpire( |
89 const content::LoadCommittedDetails& details) const { | 89 const content::LoadCommittedDetails& details) const { |
90 content::PageTransition transition = | 90 ui::PageTransition transition = |
91 content::PageTransitionStripQualifier(details.entry->GetTransitionType()); | 91 ui::PageTransitionStripQualifier(details.entry->GetTransitionType()); |
92 // We don't want to expire on a reload, because that is how we open the PDF in | 92 // We don't want to expire on a reload, because that is how we open the PDF in |
93 // Reader. | 93 // Reader. |
94 return !details.is_in_page && transition != content::PAGE_TRANSITION_RELOAD; | 94 return !details.is_in_page && transition != ui::PAGE_TRANSITION_RELOAD; |
95 } | 95 } |
96 | 96 |
97 void PDFEnableAdobeReaderPromptClient::Accept() { | 97 void PDFEnableAdobeReaderPromptClient::Accept() { |
98 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarOK")); | 98 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarOK")); |
99 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile_).get(); | 99 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile_).get(); |
100 plugin_prefs->EnablePluginGroup( | 100 plugin_prefs->EnablePluginGroup( |
101 true, base::ASCIIToUTF16(PluginMetadata::kAdobeReaderGroupName)); | 101 true, base::ASCIIToUTF16(PluginMetadata::kAdobeReaderGroupName)); |
102 plugin_prefs->EnablePluginGroup( | 102 plugin_prefs->EnablePluginGroup( |
103 false, base::ASCIIToUTF16(ChromeContentClient::kPDFPluginName)); | 103 false, base::ASCIIToUTF16(ChromeContentClient::kPDFPluginName)); |
104 } | 104 } |
(...skipping 11 matching lines...) Expand all Loading... |
116 } | 116 } |
117 | 117 |
118 base::string16 PDFEnableAdobeReaderPromptClient::GetMessageText() const { | 118 base::string16 PDFEnableAdobeReaderPromptClient::GetMessageText() const { |
119 return l10n_util::GetStringUTF16(IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); | 119 return l10n_util::GetStringUTF16(IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); |
120 } | 120 } |
121 | 121 |
122 // Launch the url to get the latest Adbobe Reader installer. | 122 // Launch the url to get the latest Adbobe Reader installer. |
123 void OpenReaderUpdateURL(WebContents* web_contents) { | 123 void OpenReaderUpdateURL(WebContents* web_contents) { |
124 OpenURLParams params( | 124 OpenURLParams params( |
125 GURL(kAdobeReaderUpdateUrl), Referrer(), NEW_FOREGROUND_TAB, | 125 GURL(kAdobeReaderUpdateUrl), Referrer(), NEW_FOREGROUND_TAB, |
126 content::PAGE_TRANSITION_LINK, false); | 126 ui::PAGE_TRANSITION_LINK, false); |
127 web_contents->OpenURL(params); | 127 web_contents->OpenURL(params); |
128 } | 128 } |
129 | 129 |
130 // Opens the PDF using Adobe Reader. | 130 // Opens the PDF using Adobe Reader. |
131 void OpenUsingReader(WebContents* web_contents, | 131 void OpenUsingReader(WebContents* web_contents, |
132 const WebPluginInfo& reader_plugin, | 132 const WebPluginInfo& reader_plugin, |
133 pdf::OpenPDFInReaderPromptClient* client) { | 133 pdf::OpenPDFInReaderPromptClient* client) { |
134 ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame( | 134 ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame( |
135 web_contents->GetRenderProcessHost()->GetID(), | 135 web_contents->GetRenderProcessHost()->GetID(), |
136 web_contents->GetMainFrame()->GetRoutingID(), | 136 web_contents->GetMainFrame()->GetRoutingID(), |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); | 358 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); |
359 return; | 359 return; |
360 } | 360 } |
361 GetAdobeReaderPluginInfoAsync( | 361 GetAdobeReaderPluginInfoAsync( |
362 profile, | 362 profile, |
363 base::Bind(&GotPluginsCallback, | 363 base::Bind(&GotPluginsCallback, |
364 web_contents->GetRenderProcessHost()->GetID(), | 364 web_contents->GetRenderProcessHost()->GetID(), |
365 web_contents->GetRenderViewHost()->GetRoutingID())); | 365 web_contents->GetRenderViewHost()->GetRoutingID())); |
366 #endif // defined(OS_WIN) | 366 #endif // defined(OS_WIN) |
367 } | 367 } |
OLD | NEW |