OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "athena/extensions/chrome/athena_extension_install_ui.h" | |
6 | |
7 #include "base/i18n/rtl.h" | |
8 #include "base/strings/utf_string_conversions.h" | |
9 #include "chrome/browser/extensions/crx_installer_error.h" | |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | |
11 #include "chrome/grit/chromium_strings.h" | |
12 #include "extensions/common/extension.h" | |
13 #include "ui/base/l10n/l10n_util.h" | |
14 #include "ui/views/widget/widget.h" | |
15 #include "ui/views/window/dialog_delegate.h" | |
16 | |
17 namespace { | |
18 | |
19 // Dialog delegate which displays a message and an 'OK' button. | |
20 class MessageDialogDelegate : public views::DialogDelegateView { | |
21 public: | |
22 explicit MessageDialogDelegate(const base::string16& message) | |
23 : message_(message) {} | |
24 | |
25 virtual ~MessageDialogDelegate() { | |
26 } | |
27 | |
28 // views::DialogDelegateView: | |
29 virtual base::string16 GetWindowTitle() const override { | |
30 return message_; | |
31 } | |
32 | |
33 virtual int GetDialogButtons() const override { | |
34 return ui::DIALOG_BUTTON_OK; | |
35 } | |
36 | |
37 private: | |
38 base::string16 message_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(MessageDialogDelegate); | |
41 }; | |
42 | |
43 } // namespace | |
44 | |
45 // static | |
46 ExtensionInstallUI* ExtensionInstallUI::Create(Profile* profile) { | |
47 return new AthenaExtensionInstallUI(profile); | |
48 } | |
49 | |
50 // static | |
51 void ExtensionInstallUI::OpenAppInstalledUI(Profile* profile, | |
52 const std::string& app_id) { | |
53 NOTREACHED(); | |
54 } | |
55 | |
56 // static | |
57 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( | |
58 Profile* profile) { | |
59 return new ExtensionInstallPrompt(profile, NULL, NULL); | |
60 } | |
oshima
2014/10/10 15:36:15
Having these in athena ain't great. let's dicuss o
pkotwicz
2014/10/10 16:43:21
This is not the only CL needed in order to get ins
oshima
2014/10/10 17:06:10
This is structural issue than dependency. I'm ok a
| |
61 | |
62 AthenaExtensionInstallUI::AthenaExtensionInstallUI(Profile* profile) | |
63 : ExtensionInstallUI(profile) { | |
64 } | |
65 | |
66 AthenaExtensionInstallUI::~AthenaExtensionInstallUI() { | |
67 } | |
68 | |
69 void AthenaExtensionInstallUI::OnInstallSuccess( | |
70 const extensions::Extension* extension, | |
71 const SkBitmap* icon) { | |
72 base::string16 extension_name = base::UTF8ToUTF16(extension->name()); | |
73 base::i18n::AdjustStringForLocaleDirection(&extension_name); | |
74 base::string16 message = l10n_util::GetStringFUTF16( | |
75 IDS_EXTENSION_INSTALLED_HEADING, extension_name); | |
76 views::Widget* widget = views::DialogDelegate::CreateDialogWidget( | |
77 new MessageDialogDelegate(message), NULL, NULL); | |
78 widget->Show(); | |
79 } | |
80 | |
81 void AthenaExtensionInstallUI::OnInstallFailure( | |
82 const extensions::CrxInstallerError& error) { | |
83 views::Widget* widget = views::DialogDelegate::CreateDialogWidget( | |
84 new MessageDialogDelegate(error.message()), NULL, NULL); | |
85 widget->Show(); | |
86 } | |
87 | |
88 void AthenaExtensionInstallUI::SetUseAppInstalledBubble(bool use_bubble) { | |
89 } | |
OLD | NEW |