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

Side by Side Diff: chrome/browser/plugins/plugin_infobar_delegates.cc

Issue 23591005: Update infobar buttons when attempting to run an NPAPI plugin in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change string to say open. Created 7 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
« no previous file with comments | « chrome/browser/plugins/plugin_infobar_delegates.h ('k') | no next file » | 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) 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/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 int PluginMetroModeInfoBarDelegate::GetIconID() const { 469 int PluginMetroModeInfoBarDelegate::GetIconID() const {
470 return IDR_INFOBAR_PLUGIN_INSTALL; 470 return IDR_INFOBAR_PLUGIN_INSTALL;
471 } 471 }
472 472
473 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { 473 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const {
474 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? 474 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ?
475 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); 475 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_);
476 } 476 }
477 477
478 int PluginMetroModeInfoBarDelegate::GetButtons() const { 478 int PluginMetroModeInfoBarDelegate::GetButtons() const {
479 return (mode_ == MISSING_PLUGIN) ? BUTTON_OK : (BUTTON_OK | BUTTON_CANCEL); 479 return BUTTON_OK;
480 } 480 }
481 481
482 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( 482 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel(
483 InfoBarButton button) const { 483 InfoBarButton button) const {
484 if (button == BUTTON_CANCEL)
485 return l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL);
486 return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? 484 return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ?
487 IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_RESTART); 485 IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_DESKTOP_OPEN);
488 } 486 }
489 487
490 void LaunchDesktopInstanceHelper(const string16& url) { 488 void LaunchDesktopInstanceHelper(const string16& url) {
491 base::FilePath exe_path; 489 base::FilePath exe_path;
492 if (!PathService::Get(base::FILE_EXE, &exe_path)) 490 if (!PathService::Get(base::FILE_EXE, &exe_path))
493 return; 491 return;
494 base::FilePath shortcut_path( 492 base::FilePath shortcut_path(
495 ShellIntegration::GetStartMenuShortcut(exe_path)); 493 ShellIntegration::GetStartMenuShortcut(exe_path));
496 494
497 SHELLEXECUTEINFO sei = { sizeof(sei) }; 495 SHELLEXECUTEINFO sei = { sizeof(sei) };
(...skipping 11 matching lines...) Expand all
509 content::BrowserThread::PostTask( 507 content::BrowserThread::PostTask(
510 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, 508 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
511 base::Bind(&LaunchDesktopInstanceHelper, 509 base::Bind(&LaunchDesktopInstanceHelper,
512 UTF8ToUTF16(web_contents()->GetURL().spec()))); 510 UTF8ToUTF16(web_contents()->GetURL().spec())));
513 #else 511 #else
514 chrome::AttemptRestartWithModeSwitch(); 512 chrome::AttemptRestartWithModeSwitch();
515 #endif 513 #endif
516 return true; 514 return true;
517 } 515 }
518 516
519 bool PluginMetroModeInfoBarDelegate::Cancel() {
520 DCHECK_EQ(DESKTOP_MODE_REQUIRED, mode_);
521 Profile::FromBrowserContext(web_contents()->GetBrowserContext())->
522 GetHostContentSettingsMap()->SetContentSetting(
523 ContentSettingsPattern::FromURL(web_contents()->GetURL()),
524 ContentSettingsPattern::Wildcard(),
525 CONTENT_SETTINGS_TYPE_METRO_SWITCH_TO_DESKTOP, std::string(),
526 CONTENT_SETTING_BLOCK);
527 return true;
528 }
529
530 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { 517 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const {
531 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 518 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
532 } 519 }
533 520
534 bool PluginMetroModeInfoBarDelegate::LinkClicked( 521 bool PluginMetroModeInfoBarDelegate::LinkClicked(
535 WindowOpenDisposition disposition) { 522 WindowOpenDisposition disposition) {
536 web_contents()->OpenURL(content::OpenURLParams( 523 web_contents()->OpenURL(content::OpenURLParams(
537 GURL((mode_ == MISSING_PLUGIN) ? 524 GURL((mode_ == MISSING_PLUGIN) ?
538 "https://support.google.com/chrome/?p=ib_display_in_desktop" : 525 "https://support.google.com/chrome/?p=ib_display_in_desktop" :
539 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), 526 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"),
540 content::Referrer(), 527 content::Referrer(),
541 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 528 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
542 content::PAGE_TRANSITION_LINK, false)); 529 content::PAGE_TRANSITION_LINK, false));
543 return false; 530 return false;
544 } 531 }
545 532
546 #endif // defined(OS_WIN) 533 #endif // defined(OS_WIN)
547 534
548 #endif // defined(ENABLE_PLUGIN_INSTALLATION) 535 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_infobar_delegates.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698