Chromium Code Reviews| 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/plugins/plugin_infobar_delegates.h" | 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 base::string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { | 474 base::string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { |
| 475 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? | 475 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? |
| 476 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); | 476 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); |
| 477 } | 477 } |
| 478 | 478 |
| 479 int PluginMetroModeInfoBarDelegate::GetButtons() const { | 479 int PluginMetroModeInfoBarDelegate::GetButtons() const { |
| 480 return BUTTON_OK; | 480 return BUTTON_OK; |
| 481 } | 481 } |
| 482 | 482 |
| 483 base::string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( | 483 base::string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( |
| 484 InfoBarButton button) const { | 484 InfoBarButton button) const { |
|
cpu_(ooo_6.6-7.5)
2014/08/22 21:47:11
don't you have to use USE_AURA ? or is this not co
ananta
2014/08/22 22:17:53
This block is under OS_WIN
| |
| 485 #if defined(USE_AURA) && defined(USE_ASH) | 485 return l10n_util::GetStringUTF16(IDS_WIN_DESKTOP_RESTART); |
| 486 return l10n_util::GetStringUTF16(IDS_WIN8_DESKTOP_RESTART); | |
| 487 #else | |
| 488 return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? | |
| 489 IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_DESKTOP_OPEN); | |
| 490 #endif | |
| 491 } | 486 } |
| 492 | 487 |
| 493 #if defined(USE_AURA) && defined(USE_ASH) | |
| 494 void LaunchDesktopInstanceHelper(const base::string16& url) { | 488 void LaunchDesktopInstanceHelper(const base::string16& url) { |
| 495 base::FilePath exe_path; | 489 base::FilePath exe_path; |
| 496 if (!PathService::Get(base::FILE_EXE, &exe_path)) | 490 if (!PathService::Get(base::FILE_EXE, &exe_path)) |
| 497 return; | 491 return; |
| 498 base::FilePath shortcut_path( | 492 base::FilePath shortcut_path( |
| 499 ShellIntegration::GetStartMenuShortcut(exe_path)); | 493 ShellIntegration::GetStartMenuShortcut(exe_path)); |
| 500 | 494 |
| 501 // Actually launching the process needs to happen in the metro viewer, | 495 // Actually launching the process needs to happen in the metro viewer, |
| 502 // otherwise it won't automatically transition to desktop. So we have | 496 // otherwise it won't automatically transition to desktop. So we have |
| 503 // to send an IPC to the viewer to do the ShellExecute. | 497 // to send an IPC to the viewer to do the ShellExecute. |
| 504 aura::RemoteWindowTreeHostWin::Instance()->HandleOpenURLOnDesktop( | 498 aura::RemoteWindowTreeHostWin::Instance()->HandleOpenURLOnDesktop( |
| 505 shortcut_path, url); | 499 shortcut_path, url); |
| 506 } | 500 } |
| 507 #endif | |
| 508 | 501 |
| 509 bool PluginMetroModeInfoBarDelegate::Accept() { | 502 bool PluginMetroModeInfoBarDelegate::Accept() { |
| 510 chrome::AttemptRestartToDesktopMode(); | 503 chrome::AttemptRestartToDesktopMode(); |
| 511 return true; | 504 return true; |
| 512 } | 505 } |
| 513 | 506 |
| 514 base::string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { | 507 base::string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { |
| 515 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 508 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 516 } | 509 } |
| 517 | 510 |
| 518 bool PluginMetroModeInfoBarDelegate::LinkClicked( | 511 bool PluginMetroModeInfoBarDelegate::LinkClicked( |
| 519 WindowOpenDisposition disposition) { | 512 WindowOpenDisposition disposition) { |
| 520 // TODO(shrikant): We may need to change language a little at following | 513 // TODO(shrikant): We may need to change language a little at following |
| 521 // support URLs. With new approach we will just restart for both missing | 514 // support URLs. With new approach we will just restart for both missing |
| 522 // and not missing mode. | 515 // and not missing mode. |
| 523 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 516 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
| 524 content::OpenURLParams( | 517 content::OpenURLParams( |
| 525 GURL((mode_ == MISSING_PLUGIN) ? | 518 GURL((mode_ == MISSING_PLUGIN) ? |
| 526 "https://support.google.com/chrome/?p=ib_display_in_desktop" : | 519 "https://support.google.com/chrome/?p=ib_display_in_desktop" : |
| 527 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 520 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
| 528 content::Referrer(), | 521 content::Referrer(), |
| 529 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 522 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 530 content::PAGE_TRANSITION_LINK, false)); | 523 content::PAGE_TRANSITION_LINK, false)); |
| 531 return false; | 524 return false; |
| 532 } | 525 } |
| 533 | 526 |
| 534 #endif // defined(OS_WIN) | 527 #endif // defined(OS_WIN) |
| 535 | 528 |
| 536 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 529 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |