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

Side by Side Diff: chrome/browser/ui/athena/extensions/extension_install_ui_athena.cc

Issue 634313004: Display dialog when app install succeeds / fails on Athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
(Empty)
1 #include "chrome/browser/ui/athena/extensions/extension_install_ui_athena.h"
2
3 #include "base/i18n/rtl.h"
4 #include "base/strings/utf_string_conversions.h"
5 #include "chrome/browser/extensions/crx_installer_error.h"
6 #include "chrome/browser/extensions/extension_install_prompt.h"
7 #include "chrome/grit/chromium_strings.h"
8 #include "extensions/common/extension.h"
9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/views/widget/widget.h"
11 #include "ui/views/window/dialog_delegate.h"
12
13 namespace {
14
15 // Dialog delegate which displays a message and an 'OK' button.
16 class MessageDialogDelegate : public views::DialogDelegateView {
17 public:
18 explicit MessageDialogDelegate(const base::string16& message)
19 : message_(message) {}
20
21 virtual ~MessageDialogDelegate() {
22 }
23
24 // views::DialogDelegateView:
25 virtual base::string16 GetWindowTitle() const override {
26 return message_;
27 }
28
29 virtual int GetDialogButtons() const override {
30 return ui::DIALOG_BUTTON_OK;
31 }
32
33 private:
34 base::string16 message_;
35
36 DISALLOW_COPY_AND_ASSIGN(MessageDialogDelegate);
37 };
38
39 } // namespace
40
41 // static
42 ExtensionInstallUI* ExtensionInstallUI::Create(Profile* profile) {
43 return new ExtensionInstallUIAthena(profile);
44 }
45
46 // static
47 void ExtensionInstallUI::OpenAppInstalledUI(Profile* profile,
48 const std::string& app_id) {
49 NOTREACHED();
50 }
51
52 // static
53 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile(
54 Profile* profile) {
55 return new ExtensionInstallPrompt(profile, NULL, NULL);
56 }
57
58 ExtensionInstallUIAthena::ExtensionInstallUIAthena(Profile* profile)
59 : ExtensionInstallUI(profile) {
60 }
61
62 ExtensionInstallUIAthena::~ExtensionInstallUIAthena() {
63 }
64
65 void ExtensionInstallUIAthena::OnInstallSuccess(
66 const extensions::Extension* extension,
67 const SkBitmap* icon) {
68 base::string16 extension_name = base::UTF8ToUTF16(extension->name());
69 base::i18n::AdjustStringForLocaleDirection(&extension_name);
70 base::string16 message = l10n_util::GetStringFUTF16(
71 IDS_EXTENSION_INSTALLED_HEADING, extension_name);
72 views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
73 new MessageDialogDelegate(message), NULL, NULL);
74 widget->Show();
75 }
76
77 void ExtensionInstallUIAthena::OnInstallFailure(
78 const extensions::CrxInstallerError& error) {
79 views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
80 new MessageDialogDelegate(error.message()), NULL, NULL);
pkotwicz 2014/10/09 00:55:11 We should eventually figure out whether these dial
81 widget->Show();
82 }
83
84 void ExtensionInstallUIAthena::SetUseAppInstalledBubble(bool use_bubble) {
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698