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_APP_INFO_SUMMARY_PANEL_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" | 10 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" |
10 #include "chrome/common/extensions/extension_constants.h" | 11 #include "chrome/common/extensions/extension_constants.h" |
11 #include "ui/views/controls/combobox/combobox_listener.h" | 12 #include "ui/views/controls/combobox/combobox_listener.h" |
12 | 13 |
13 class LaunchOptionsComboboxModel; | 14 class LaunchOptionsComboboxModel; |
14 class Profile; | 15 class Profile; |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 class Extension; | 18 class Extension; |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 class Combobox; | 22 class Combobox; |
22 class Label; | 23 class Label; |
23 } | 24 } |
24 | 25 |
25 // The summary panel of the app info dialog, which provides basic information | 26 // The summary panel of the app info dialog, which provides basic information |
26 // and controls related to the app. | 27 // and controls related to the app. |
27 class AppInfoSummaryPanel : public AppInfoPanel, | 28 class AppInfoSummaryPanel : public AppInfoPanel, |
28 public views::ComboboxListener { | 29 public views::ComboboxListener, |
| 30 public base::SupportsWeakPtr<AppInfoSummaryPanel> { |
29 public: | 31 public: |
30 AppInfoSummaryPanel(Profile* profile, const extensions::Extension* app); | 32 AppInfoSummaryPanel(Profile* profile, const extensions::Extension* app); |
31 | 33 |
32 virtual ~AppInfoSummaryPanel(); | 34 virtual ~AppInfoSummaryPanel(); |
33 | 35 |
34 private: | 36 private: |
35 // Internal initialisation methods. | 37 // Internal initialisation methods. |
36 void CreateDescriptionControl(); | 38 void CreateDescriptionControl(); |
37 void CreateDetailsControl(); | 39 void CreateDetailsControl(); |
38 void CreateLaunchOptionControl(); | 40 void CreateLaunchOptionControl(); |
39 | 41 |
40 void LayoutDescriptionControl(); | 42 void LayoutDescriptionControl(); |
41 void LayoutDetailsControl(); | 43 void LayoutDetailsControl(); |
42 | 44 |
43 // Overridden from views::ComboboxListener: | 45 // Overridden from views::ComboboxListener: |
44 virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE; | 46 virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE; |
45 | 47 |
| 48 // Called asynchronously to calculate and update the size of the app displayed |
| 49 // in the dialog. |
| 50 void StartCalculatingAppSize(); |
| 51 void OnAppSizeCalculated(int64 app_size_in_bytes); |
| 52 |
46 // Returns the time this app was installed. | 53 // Returns the time this app was installed. |
47 base::Time GetInstalledTime() const; | 54 base::Time GetInstalledTime() const; |
48 | 55 |
49 // Returns the time the app was last launched, or base::Time() if it's never | 56 // Returns the time the app was last launched, or base::Time() if it's never |
50 // been launched. | 57 // been launched. |
51 base::Time GetLastLaunchedTime() const; | 58 base::Time GetLastLaunchedTime() const; |
52 | 59 |
53 // Returns the launch type of the app (e.g. pinned tab, fullscreen, etc). | 60 // Returns the launch type of the app (e.g. pinned tab, fullscreen, etc). |
54 extensions::LaunchType GetLaunchType() const; | 61 extensions::LaunchType GetLaunchType() const; |
55 | 62 |
56 // Sets the launch type of the app to the given type. Must only be called if | 63 // Sets the launch type of the app to the given type. Must only be called if |
57 // CanSetLaunchType() returns true. | 64 // CanSetLaunchType() returns true. |
58 void SetLaunchType(extensions::LaunchType) const; | 65 void SetLaunchType(extensions::LaunchType) const; |
59 bool CanSetLaunchType() const; | 66 bool CanSetLaunchType() const; |
60 | 67 |
61 // UI elements on the dialog. | 68 // UI elements on the dialog. |
62 views::Label* description_heading_; | 69 views::Label* description_heading_; |
63 views::Label* description_label_; | 70 views::Label* description_label_; |
64 | 71 |
65 views::Label* details_heading_; | 72 views::Label* details_heading_; |
| 73 views::Label* size_title_; |
| 74 views::Label* size_value_; |
66 views::Label* version_title_; | 75 views::Label* version_title_; |
67 views::Label* version_value_; | 76 views::Label* version_value_; |
68 views::Label* installed_time_title_; | 77 views::Label* installed_time_title_; |
69 views::Label* installed_time_value_; | 78 views::Label* installed_time_value_; |
70 views::Label* last_run_time_title_; | 79 views::Label* last_run_time_title_; |
71 views::Label* last_run_time_value_; | 80 views::Label* last_run_time_value_; |
72 | 81 |
73 scoped_ptr<LaunchOptionsComboboxModel> launch_options_combobox_model_; | 82 scoped_ptr<LaunchOptionsComboboxModel> launch_options_combobox_model_; |
74 views::Combobox* launch_options_combobox_; | 83 views::Combobox* launch_options_combobox_; |
75 | 84 |
| 85 base::WeakPtrFactory<AppInfoSummaryPanel> weak_ptr_factory_; |
| 86 |
76 DISALLOW_COPY_AND_ASSIGN(AppInfoSummaryPanel); | 87 DISALLOW_COPY_AND_ASSIGN(AppInfoSummaryPanel); |
77 }; | 88 }; |
78 | 89 |
79 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H
_ | 90 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H
_ |
OLD | NEW |