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

Side by Side Diff: athena/extensions/chrome/athena_extension_install_ui.cc

Issue 863033002: Delete athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/extension_install_prompt.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/grit/chromium_strings.h"
12 #include "extensions/browser/install/crx_installer_error.h"
13 #include "extensions/common/extension.h"
14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/views/widget/widget.h"
16 #include "ui/views/window/dialog_delegate.h"
17
18 namespace athena {
19
20 namespace {
21
22 // Dialog delegate which displays a message and an 'OK' button.
23 class MessageDialogDelegate : public views::DialogDelegateView {
24 public:
25 explicit MessageDialogDelegate(const base::string16& message)
26 : message_(message) {}
27
28 ~MessageDialogDelegate() override {}
29
30 // views::DialogDelegateView:
31 base::string16 GetWindowTitle() const override { return message_; }
32
33 int GetDialogButtons() const override { return ui::DIALOG_BUTTON_OK; }
34
35 private:
36 base::string16 message_;
37
38 DISALLOW_COPY_AND_ASSIGN(MessageDialogDelegate);
39 };
40
41 } // namespace
42
43 AthenaExtensionInstallUI::AthenaExtensionInstallUI()
44 : skip_post_install_ui_(false) {
45 }
46
47 AthenaExtensionInstallUI::~AthenaExtensionInstallUI() {
48 }
49
50 void AthenaExtensionInstallUI::OnInstallSuccess(
51 const extensions::Extension* extension,
52 const SkBitmap* icon) {
53 if (skip_post_install_ui_)
54 return;
55
56 base::string16 extension_name = base::UTF8ToUTF16(extension->name());
57 base::i18n::AdjustStringForLocaleDirection(&extension_name);
58 base::string16 message = l10n_util::GetStringFUTF16(
59 IDS_EXTENSION_INSTALLED_HEADING, extension_name);
60 views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
61 new MessageDialogDelegate(message), nullptr, nullptr);
62 widget->Show();
63 }
64
65 void AthenaExtensionInstallUI::OnInstallFailure(
66 const extensions::CrxInstallerError& error) {
67 if (skip_post_install_ui_)
68 return;
69
70 views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
71 new MessageDialogDelegate(error.message()), nullptr, nullptr);
72 widget->Show();
73 }
74
75 void AthenaExtensionInstallUI::SetUseAppInstalledBubble(bool use_bubble) {
76 }
77
78 void AthenaExtensionInstallUI::OpenAppInstalledUI(const std::string& app_id) {
79 NOTREACHED();
80 }
81
82 void AthenaExtensionInstallUI::SetSkipPostInstallUI(bool skip_ui) {
83 skip_post_install_ui_ = skip_ui;
84 }
85
86 gfx::NativeWindow AthenaExtensionInstallUI::GetDefaultInstallDialogParent() {
87 return nullptr;
88 }
89
90 } // namespace athena
OLDNEW
« no previous file with comments | « athena/extensions/chrome/athena_extension_install_ui.h ('k') | athena/extensions/chrome/chrome_search_controller_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698