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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: athena/extensions/chrome/athena_extension_install_ui.cc
diff --git a/athena/extensions/chrome/athena_extension_install_ui.cc b/athena/extensions/chrome/athena_extension_install_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3b2ff80e1a92d629aa2dbeb69f1edb4de3be0ffa
--- /dev/null
+++ b/athena/extensions/chrome/athena_extension_install_ui.cc
@@ -0,0 +1,89 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "athena/extensions/chrome/athena_extension_install_ui.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 AthenaExtensionInstallUI(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);
+}
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
+
+AthenaExtensionInstallUI::AthenaExtensionInstallUI(Profile* profile)
+ : ExtensionInstallUI(profile) {
+}
+
+AthenaExtensionInstallUI::~AthenaExtensionInstallUI() {
+}
+
+void AthenaExtensionInstallUI::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 AthenaExtensionInstallUI::OnInstallFailure(
+ const extensions::CrxInstallerError& error) {
+ views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
+ new MessageDialogDelegate(error.message()), NULL, NULL);
+ widget->Show();
+}
+
+void AthenaExtensionInstallUI::SetUseAppInstalledBubble(bool use_bubble) {
+}

Powered by Google App Engine
This is Rietveld 408576698