Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h |
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..89863166aa5ae9aab9b00fac407279ab443309de |
--- /dev/null |
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h |
@@ -0,0 +1,92 @@ |
+// 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. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ |
+#define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ |
+ |
+#include "base/callback_forward.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/extensions/extension_uninstall_dialog.h" |
+#include "ui/gfx/native_widget_types.h" |
+#include "ui/views/controls/link_listener.h" |
+#include "ui/views/view.h" |
+class Profile; |
+namespace extensions { |
+class Extension; |
+} |
+namespace gfx { |
+class Image; |
+} |
+namespace views { |
+class ImageView; |
+class Label; |
+class Link; |
+} |
+ |
+// A small summary panel with the app's name, icon, version, and various links. |
+class AppInfoSummaryPanel |
+ : public views::View, |
+ public views::LinkListener, |
+ public extensions::ExtensionUninstallDialog::Delegate, |
+ public base::SupportsWeakPtr<AppInfoSummaryPanel> { |
+ public: |
+ AppInfoSummaryPanel(gfx::NativeWindow parent_window, |
+ Profile* profile, |
+ const extensions::Extension* app, |
+ const base::Closure& close_callback); |
+ virtual ~AppInfoSummaryPanel(); |
+ |
+ private: |
+ void CreateControls(); |
+ void LayoutAppNameAndVersionInto(views::View* parent_view); |
+ void LayoutControls(); |
+ |
+ // Overridden from views::LinkListener: |
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
+ |
+ // Overridden from ExtensionUninstallDialog::Delegate: |
+ virtual void ExtensionUninstallAccepted() OVERRIDE; |
+ virtual void ExtensionUninstallCanceled() OVERRIDE; |
+ |
+ // Load the app icon asynchronously. For the response, check OnAppImageLoaded. |
+ void LoadAppImageAsync(); |
+ // Called when the app's icon is loaded. |
+ void OnAppImageLoaded(const gfx::Image& image); |
+ |
+ // Opens the app in the web store. Must only be called if |
+ // CanShowAppInWebStore() returns true. |
+ void ShowAppInWebStore() const; |
+ bool CanShowAppInWebStore() const; |
+ |
+ // Uninstall the app. Must only be called if CanUninstallApp() returns true. |
+ void UninstallApp(); |
+ bool CanUninstallApp() const; |
+ |
+ // Displays the licenses for the app. Must only be called if |
+ // CanDisplayLicenses() returns true. |
+ void DisplayLicenses(); |
+ bool CanDisplayLicenses(); |
+ |
+ // UI elements on the dialog. Elements are NULL if they are not displayed. |
+ views::ImageView* app_icon_; |
+ views::Label* app_name_label_; |
+ views::Label* app_version_label_; |
+ views::Link* view_in_store_link_; |
+ views::Link* remove_link_; |
+ views::Link* licenses_link_; |
+ |
+ gfx::NativeWindow parent_window_; |
+ Profile* profile_; |
+ const extensions::Extension* app_; |
+ base::Closure close_callback_; |
+ |
+ scoped_ptr<extensions::ExtensionUninstallDialog> extension_uninstall_dialog_; |
+ |
+ base::WeakPtrFactory<AppInfoSummaryPanel> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppInfoSummaryPanel); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ |