Home | History | Annotate | Download | only in app_info_dialog
      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.
      4 
      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_
      7 
      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"
     13 
     14 class LaunchOptionsComboboxModel;
     15 class Profile;
     16 
     17 namespace extensions {
     18 class Extension;
     19 }
     20 
     21 namespace views {
     22 class Combobox;
     23 class Label;
     24 }
     25 
     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> {
     31  public:
     32   AppInfoSummaryPanel(Profile* profile, const extensions::Extension* app);
     33 
     34   virtual ~AppInfoSummaryPanel();
     35 
     36  private:
     37   // Internal initialisation methods.
     38   void CreateDescriptionControl();
     39   void CreateDetailsControl();
     40   void CreateLaunchOptionControl();
     41 
     42   void LayoutDescriptionControl();
     43   void LayoutDetailsControl();
     44 
     45   // Overridden from views::ComboboxListener:
     46   virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE;
     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 
     53   // Returns the time this app was installed.
     54   base::Time GetInstalledTime() const;
     55 
     56   // Returns the time the app was last launched, or base::Time() if it's never
     57   // been launched.
     58   base::Time GetLastLaunchedTime() const;
     59 
     60   // Returns the launch type of the app (e.g. pinned tab, fullscreen, etc).
     61   extensions::LaunchType GetLaunchType() const;
     62 
     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;
     67 
     68   // UI elements on the dialog.
     69   views::Label* description_heading_;
     70   views::Label* description_label_;
     71 
     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_;
     81 
     82   scoped_ptr<LaunchOptionsComboboxModel> launch_options_combobox_model_;
     83   views::Combobox* launch_options_combobox_;
     84 
     85   base::WeakPtrFactory<AppInfoSummaryPanel> weak_ptr_factory_;
     86 
     87   DISALLOW_COPY_AND_ASSIGN(AppInfoSummaryPanel);
     88 };
     89 
     90 #endif  // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_SUMMARY_PANEL_H_
     91