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