Chromium Code Reviews| Index: chrome/browser/ui/athena/extensions/extension_install_ui_athena.cc |
| diff --git a/chrome/browser/ui/athena/extensions/extension_install_ui_athena.cc b/chrome/browser/ui/athena/extensions/extension_install_ui_athena.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0febb3bd7b667396085260f236e9a02f00c8dc36 |
| --- /dev/null |
| +++ b/chrome/browser/ui/athena/extensions/extension_install_ui_athena.cc |
| @@ -0,0 +1,85 @@ |
| +#include "chrome/browser/ui/athena/extensions/extension_install_ui_athena.h" |
| + |
| +#include "base/i18n/rtl.h" |
| +#include "base/strings/utf_string_conversions.h" |
| +#include "chrome/browser/extensions/crx_installer_error.h" |
| +#include "chrome/browser/extensions/extension_install_prompt.h" |
| +#include "chrome/grit/chromium_strings.h" |
| +#include "extensions/common/extension.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| +#include "ui/views/widget/widget.h" |
| +#include "ui/views/window/dialog_delegate.h" |
| + |
| +namespace { |
| + |
| +// Dialog delegate which displays a message and an 'OK' button. |
| +class MessageDialogDelegate : public views::DialogDelegateView { |
| + public: |
| + explicit MessageDialogDelegate(const base::string16& message) |
| + : message_(message) {} |
| + |
| + virtual ~MessageDialogDelegate() { |
| + } |
| + |
| + // views::DialogDelegateView: |
| + virtual base::string16 GetWindowTitle() const override { |
| + return message_; |
| + } |
| + |
| + virtual int GetDialogButtons() const override { |
| + return ui::DIALOG_BUTTON_OK; |
| + } |
| + |
| + private: |
| + base::string16 message_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MessageDialogDelegate); |
| +}; |
| + |
| +} // namespace |
| + |
| +// static |
| +ExtensionInstallUI* ExtensionInstallUI::Create(Profile* profile) { |
| + return new ExtensionInstallUIAthena(profile); |
| +} |
| + |
| +// static |
| +void ExtensionInstallUI::OpenAppInstalledUI(Profile* profile, |
| + const std::string& app_id) { |
| + NOTREACHED(); |
| +} |
| + |
| +// static |
| +ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( |
| + Profile* profile) { |
| + return new ExtensionInstallPrompt(profile, NULL, NULL); |
| +} |
| + |
| +ExtensionInstallUIAthena::ExtensionInstallUIAthena(Profile* profile) |
| + : ExtensionInstallUI(profile) { |
| +} |
| + |
| +ExtensionInstallUIAthena::~ExtensionInstallUIAthena() { |
| +} |
| + |
| +void ExtensionInstallUIAthena::OnInstallSuccess( |
| + const extensions::Extension* extension, |
| + const SkBitmap* icon) { |
| + base::string16 extension_name = base::UTF8ToUTF16(extension->name()); |
| + base::i18n::AdjustStringForLocaleDirection(&extension_name); |
| + base::string16 message = l10n_util::GetStringFUTF16( |
| + IDS_EXTENSION_INSTALLED_HEADING, extension_name); |
| + views::Widget* widget = views::DialogDelegate::CreateDialogWidget( |
| + new MessageDialogDelegate(message), NULL, NULL); |
| + widget->Show(); |
| +} |
| + |
| +void ExtensionInstallUIAthena::OnInstallFailure( |
| + const extensions::CrxInstallerError& error) { |
| + views::Widget* widget = views::DialogDelegate::CreateDialogWidget( |
| + new MessageDialogDelegate(error.message()), NULL, NULL); |
|
pkotwicz
2014/10/09 00:55:11
We should eventually figure out whether these dial
|
| + widget->Show(); |
| +} |
| + |
| +void ExtensionInstallUIAthena::SetUseAppInstalledBubble(bool use_bubble) { |
| +} |