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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/common/renderer_preferences.h" | 33 #include "content/public/common/renderer_preferences.h" |
34 #include "grit/browser_resources.h" | 34 #include "grit/browser_resources.h" |
35 #include "grit/components_strings.h" | 35 #include "grit/components_strings.h" |
36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
37 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
38 #include "ui/base/webui/jstemplate_builder.h" | 38 #include "ui/base/webui/jstemplate_builder.h" |
39 | 39 |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 #include "base/win/metro.h" | |
42 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" | 41 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" |
43 #endif | 42 #endif |
44 | 43 |
45 using base::UserMetricsAction; | 44 using base::UserMetricsAction; |
46 using content::InterstitialPage; | 45 using content::InterstitialPage; |
47 using content::OpenURLParams; | 46 using content::OpenURLParams; |
48 using content::Referrer; | 47 using content::Referrer; |
49 using content::WebContents; | 48 using content::WebContents; |
50 using content::WebPluginInfo; | 49 using content::WebPluginInfo; |
51 | 50 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 267 } |
269 | 268 |
270 PDFUnsupportedFeaturePromptClient::~PDFUnsupportedFeaturePromptClient() { | 269 PDFUnsupportedFeaturePromptClient::~PDFUnsupportedFeaturePromptClient() { |
271 } | 270 } |
272 | 271 |
273 base::string16 PDFUnsupportedFeaturePromptClient::GetMessageText() const { | 272 base::string16 PDFUnsupportedFeaturePromptClient::GetMessageText() const { |
274 return l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_MESSAGE); | 273 return l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_MESSAGE); |
275 } | 274 } |
276 | 275 |
277 base::string16 PDFUnsupportedFeaturePromptClient::GetAcceptButtonText() const { | 276 base::string16 PDFUnsupportedFeaturePromptClient::GetAcceptButtonText() const { |
278 if (base::win::IsMetroProcess()) | |
279 return l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_METRO_MODE_LINK); | |
280 | |
281 return l10n_util::GetStringUTF16( | 277 return l10n_util::GetStringUTF16( |
282 reader_info_.is_installed ? IDS_PDF_BUBBLE_OPEN_IN_READER_LINK | 278 reader_info_.is_installed ? IDS_PDF_BUBBLE_OPEN_IN_READER_LINK |
283 : IDS_PDF_BUBBLE_INSTALL_READER_LINK); | 279 : IDS_PDF_BUBBLE_INSTALL_READER_LINK); |
284 } | 280 } |
285 | 281 |
286 base::string16 PDFUnsupportedFeaturePromptClient::GetCancelButtonText() const { | 282 base::string16 PDFUnsupportedFeaturePromptClient::GetCancelButtonText() const { |
287 return l10n_util::GetStringUTF16(IDS_DONE); | 283 return l10n_util::GetStringUTF16(IDS_DONE); |
288 } | 284 } |
289 | 285 |
290 bool PDFUnsupportedFeaturePromptClient::ShouldExpire( | 286 bool PDFUnsupportedFeaturePromptClient::ShouldExpire( |
291 const content::LoadCommittedDetails& details) const { | 287 const content::LoadCommittedDetails& details) const { |
292 return !details.is_in_page; | 288 return !details.is_in_page; |
293 } | 289 } |
294 | 290 |
295 void PDFUnsupportedFeaturePromptClient::Accept() { | 291 void PDFUnsupportedFeaturePromptClient::Accept() { |
296 if (base::win::IsMetroProcess()) { | |
297 chrome::AttemptRestartToDesktopMode(); | |
298 return; | |
299 } | |
300 | |
301 if (!reader_info_.is_installed) { | 292 if (!reader_info_.is_installed) { |
302 content::RecordAction(UserMetricsAction("PDF_InstallReaderInfoBarOK")); | 293 content::RecordAction(UserMetricsAction("PDF_InstallReaderInfoBarOK")); |
303 OpenReaderUpdateURL(web_contents_); | 294 OpenReaderUpdateURL(web_contents_); |
304 return; | 295 return; |
305 } | 296 } |
306 | 297 |
307 content::RecordAction(UserMetricsAction("PDF_UseReaderInfoBarOK")); | 298 content::RecordAction(UserMetricsAction("PDF_UseReaderInfoBarOK")); |
308 | 299 |
309 if (!reader_info_.is_secure) { | 300 if (!reader_info_.is_secure) { |
310 new PDFUnsupportedFeatureInterstitial(web_contents_, | 301 new PDFUnsupportedFeatureInterstitial(web_contents_, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); | 353 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); |
363 return; | 354 return; |
364 } | 355 } |
365 GetAdobeReaderPluginInfoAsync( | 356 GetAdobeReaderPluginInfoAsync( |
366 profile, | 357 profile, |
367 base::Bind(&GotPluginsCallback, | 358 base::Bind(&GotPluginsCallback, |
368 web_contents->GetRenderProcessHost()->GetID(), | 359 web_contents->GetRenderProcessHost()->GetID(), |
369 web_contents->GetRenderViewHost()->GetRoutingID())); | 360 web_contents->GetRenderViewHost()->GetRoutingID())); |
370 #endif // defined(OS_WIN) | 361 #endif // defined(OS_WIN) |
371 } | 362 } |
OLD | NEW |