Chromium Code Reviews| Index: chrome/browser/plugins/plugin_infobar_delegates.cc |
| =================================================================== |
| --- chrome/browser/plugins/plugin_infobar_delegates.cc (revision 174486) |
| +++ chrome/browser/plugins/plugin_infobar_delegates.cc (working copy) |
| @@ -438,15 +438,11 @@ |
| #if defined(OS_WIN) |
| PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
| InfoBarService* infobar_service, |
| - const string16& message, |
| - const string16& ok_label, |
| - const GURL& learn_more_url, |
| - bool show_dont_ask_again_button) |
| + PluginMetroModeInfoBarDelegate::Mode mode, |
| + const string16& name) |
| : ConfirmInfoBarDelegate(infobar_service), |
| - message_(message), |
| - ok_label_(ok_label), |
| - learn_more_url_(learn_more_url), |
| - show_dont_ask_again_button_(show_dont_ask_again_button) { |
| + mode_(mode), |
| + name_(name) { |
| } |
| PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { |
| @@ -458,26 +454,20 @@ |
| } |
| string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { |
| - return message_; |
| + return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? |
| + IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); |
| } |
| int PluginMetroModeInfoBarDelegate::GetButtons() const { |
| - int buttons = BUTTON_OK; |
| - if (show_dont_ask_again_button_) |
| - buttons |= BUTTON_CANCEL; |
| - return buttons; |
| + return (mode_ == MISSING_PLUGIN) ? BUTTON_OK : (BUTTON_OK | BUTTON_CANCEL); |
|
Bernhard Bauer
2012/12/22 01:55:54
I think making these into switch statements would
Peter Kasting
2012/12/26 18:40:36
I'm not a huge fan of switches for a two-element e
Bernhard Bauer
2012/12/26 22:38:59
I know what you mean, but the same argument could
|
| } |
| string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( |
| InfoBarButton button) const { |
| - if (button == BUTTON_OK) |
| - return ok_label_; |
| - if (button == BUTTON_CANCEL) { |
| - DCHECK(show_dont_ask_again_button_); |
| + if (button == BUTTON_CANCEL) |
| return l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); |
| - } |
| - NOTREACHED(); |
| - return string16(); |
| + return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? |
| + IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_RESTART); |
| } |
| bool PluginMetroModeInfoBarDelegate::Accept() { |
| @@ -486,7 +476,6 @@ |
| } |
| bool PluginMetroModeInfoBarDelegate::Cancel() { |
| - DCHECK(show_dont_ask_again_button_); |
|
Bernhard Bauer
2012/12/22 01:55:54
Is there a reason you removed this DCHECK? I kinda
Peter Kasting
2012/12/26 18:40:36
I removed this because I killed the member variabl
|
| content::WebContents* web_contents = owner()->GetWebContents(); |
| Profile* profile = |
| Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| @@ -509,7 +498,10 @@ |
| bool PluginMetroModeInfoBarDelegate::LinkClicked( |
| WindowOpenDisposition disposition) { |
| OpenURLParams params( |
| - learn_more_url_, Referrer(), |
| + GURL((mode_ == MISSING_PLUGIN) ? |
| + "https://support.google.com/chrome/?ib_display_in_desktop" : |
| + "https://support.google.com/chrome/?ib_redirect_to_desktop"), |
| + Referrer(), |
| (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| content::PAGE_TRANSITION_LINK, false); |
| owner()->GetWebContents()->OpenURL(params); |