OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/shell_integration.h" |
| 10 #include "ui/message_center/views/bounded_scroll_view.h" |
| 11 #include "ui/views/controls/image_view.h" |
9 #include "ui/views/window/dialog_delegate.h" | 12 #include "ui/views/window/dialog_delegate.h" |
10 | 13 |
11 class Profile; | 14 class Profile; |
12 | 15 |
13 namespace extensions { | 16 namespace extensions { |
14 class Extension; | 17 class Extension; |
15 } | 18 } |
16 | 19 |
17 namespace views { | 20 namespace views { |
18 class Label; | 21 class Label; |
19 } | 22 } |
20 | 23 |
| 24 // A scrollable list of permissions for the given app. |
| 25 class PermissionsScrollView : public message_center::BoundedScrollView { |
| 26 public: |
| 27 PermissionsScrollView(int min_height, |
| 28 int max_height, |
| 29 const extensions::Extension* app); |
| 30 |
| 31 private: |
| 32 virtual ~PermissionsScrollView(); |
| 33 |
| 34 views::View* inner_scrollable_view; |
| 35 }; |
| 36 |
21 // View the information about a particular chrome application. | 37 // View the information about a particular chrome application. |
22 class AppInfoView : public views::DialogDelegateView { | 38 class AppInfoView : public views::DialogDelegateView, |
| 39 public base::SupportsWeakPtr<AppInfoView> { |
23 public: | 40 public: |
24 AppInfoView(Profile* profile, | 41 AppInfoView(Profile* profile, |
25 const extensions::Extension* app, | 42 const extensions::Extension* app, |
26 const base::Closure& close_callback); | 43 const base::Closure& close_callback); |
27 | 44 |
28 private: | 45 private: |
29 virtual ~AppInfoView(); | 46 virtual ~AppInfoView(); |
30 | 47 |
31 // Overridden from views::View: | 48 // Overridden from views::View: |
32 virtual gfx::Size GetPreferredSize() OVERRIDE; | 49 virtual gfx::Size GetPreferredSize() OVERRIDE; |
33 | 50 |
34 // Overridden from views::DialogDelegate: | 51 // Overridden from views::DialogDelegate: |
35 virtual bool Cancel() OVERRIDE; | 52 virtual bool Cancel() OVERRIDE; |
36 virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) | 53 virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) |
37 const OVERRIDE; | 54 const OVERRIDE; |
38 virtual int GetDialogButtons() const OVERRIDE; | 55 virtual int GetDialogButtons() const OVERRIDE; |
39 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 56 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
40 | 57 |
41 // Overridden from views::WidgetDelegate: | 58 // Overridden from views::WidgetDelegate: |
42 virtual ui::ModalType GetModalType() const OVERRIDE; | 59 virtual ui::ModalType GetModalType() const OVERRIDE; |
43 virtual base::string16 GetWindowTitle() const OVERRIDE; | 60 virtual base::string16 GetWindowTitle() const OVERRIDE; |
44 | 61 |
| 62 // Called when the app's icon is loaded. |
| 63 void OnAppImageLoaded(const gfx::Image& image); |
| 64 |
45 // Profile in which the shortcuts will be created. | 65 // Profile in which the shortcuts will be created. |
46 Profile* profile_; | 66 Profile* profile_; |
47 | 67 |
48 // UI elements on the dialog. | 68 // UI elements on the dialog. |
49 views::Label* app_name_label; | 69 views::Label* app_name_label; |
50 views::Label* app_description_label; | 70 views::Label* app_description_label; |
| 71 views::Label* app_version_label; |
| 72 views::ImageView* app_icon; |
| 73 views::Label* permission_list_heading; |
| 74 PermissionsScrollView* permissions_scroll_view; |
51 | 75 |
52 const extensions::Extension* app_; | 76 const extensions::Extension* app_; |
53 base::Closure close_callback_; | 77 base::Closure close_callback_; |
54 | 78 |
| 79 base::WeakPtrFactory<AppInfoView> weak_ptr_factory_; |
| 80 |
55 DISALLOW_COPY_AND_ASSIGN(AppInfoView); | 81 DISALLOW_COPY_AND_ASSIGN(AppInfoView); |
56 }; | 82 }; |
57 | 83 |
58 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ | 84 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_VIEWS_H_ |
OLD | NEW |