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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/api/infobars/infobar_service.h" | 8 #include "chrome/browser/api/infobars/infobar_service.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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 if (!owner()) | 430 if (!owner()) |
431 return; | 431 return; |
432 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( | 432 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( |
433 owner(), installer(), plugin_metadata_->Clone(), | 433 owner(), installer(), plugin_metadata_->Clone(), |
434 base::Closure(), new_install_, message); | 434 base::Closure(), new_install_, message); |
435 owner()->ReplaceInfoBar(this, delegate); | 435 owner()->ReplaceInfoBar(this, delegate); |
436 } | 436 } |
437 | 437 |
438 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 438 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
439 #if defined(OS_WIN) | 439 #if defined(OS_WIN) |
440 InfoBarDelegate* PluginMetroModeInfoBarDelegate::Create( | |
441 InfoBarService* infobar_service, const string16& plugin_name) { | |
442 string16 message = l10n_util::GetStringFUTF16( | |
443 IDS_METRO_MISSING_PLUGIN_PROMPT, plugin_name); | |
444 return new PluginMetroModeInfoBarDelegate( | |
445 infobar_service, message); | |
446 } | |
447 | |
448 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( | 440 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
449 InfoBarService* infobar_service, const string16& message) | 441 InfoBarService* infobar_service, |
| 442 const string16& message, |
| 443 const string16& ok_label) |
450 : ConfirmInfoBarDelegate(infobar_service), | 444 : ConfirmInfoBarDelegate(infobar_service), |
451 message_(message) { | 445 message_(message), |
| 446 ok_label_(ok_label) { |
452 } | 447 } |
453 | 448 |
454 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { | 449 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { |
455 } | 450 } |
456 | 451 |
457 gfx::Image* PluginMetroModeInfoBarDelegate::GetIcon() const { | 452 gfx::Image* PluginMetroModeInfoBarDelegate::GetIcon() const { |
458 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 453 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
459 IDR_INFOBAR_PLUGIN_INSTALL); | 454 IDR_INFOBAR_PLUGIN_INSTALL); |
460 } | 455 } |
461 | 456 |
462 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { | 457 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { |
463 return message_; | 458 return message_; |
464 } | 459 } |
465 | 460 |
466 int PluginMetroModeInfoBarDelegate::GetButtons() const { | 461 int PluginMetroModeInfoBarDelegate::GetButtons() const { |
467 return BUTTON_OK; | 462 return BUTTON_OK; |
468 } | 463 } |
469 | 464 |
470 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( | 465 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( |
471 InfoBarButton button) const { | 466 InfoBarButton button) const { |
472 DCHECK_EQ(BUTTON_OK, button); | 467 DCHECK_EQ(BUTTON_OK, button); |
473 return l10n_util::GetStringUTF16(IDS_WIN8_DESKTOP_RESTART); | 468 return ok_label_; |
474 } | 469 } |
475 | 470 |
476 bool PluginMetroModeInfoBarDelegate::Accept() { | 471 bool PluginMetroModeInfoBarDelegate::Accept() { |
477 content::WebContents* web_contents = owner()->GetWebContents(); | 472 content::WebContents* web_contents = owner()->GetWebContents(); |
478 if (!web_contents) | 473 if (!web_contents) |
479 return false; | 474 return false; |
480 // Note that empty urls are not valid. | 475 // Note that empty urls are not valid. |
481 if (!web_contents->GetURL().is_valid()) | 476 if (!web_contents->GetURL().is_valid()) |
482 return false; | 477 return false; |
483 std::string url(web_contents->GetURL().spec()); | 478 std::string url(web_contents->GetURL().spec()); |
(...skipping 12 matching lines...) Expand all Loading... |
496 "https://support.google.com/chrome/?ib_display_in_desktop")); | 491 "https://support.google.com/chrome/?ib_display_in_desktop")); |
497 OpenURLParams params( | 492 OpenURLParams params( |
498 url, Referrer(), | 493 url, Referrer(), |
499 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 494 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
500 content::PAGE_TRANSITION_LINK, false); | 495 content::PAGE_TRANSITION_LINK, false); |
501 owner()->GetWebContents()->OpenURL(params); | 496 owner()->GetWebContents()->OpenURL(params); |
502 return false; | 497 return false; |
503 } | 498 } |
504 #endif // defined(OS_WIN) | 499 #endif // defined(OS_WIN) |
505 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 500 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
OLD | NEW |