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

Side by Side Diff: athena/extensions/chrome/athena_extension_install_ui.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 // 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698