Home | History | Annotate | Download | only in views
      1 // Copyright (c) 2012 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_UNINSTALL_VIEW_H_
      6 #define CHROME_BROWSER_UI_VIEWS_UNINSTALL_VIEW_H_
      7 
      8 #include <map>
      9 
     10 #include "base/basictypes.h"
     11 #include "base/callback.h"
     12 #include "base/compiler_specific.h"
     13 #include "base/strings/string16.h"
     14 #include "ui/base/models/combobox_model.h"
     15 #include "ui/views/controls/button/button.h"
     16 #include "ui/views/window/dialog_delegate.h"
     17 
     18 namespace views {
     19 class Checkbox;
     20 class Combobox;
     21 class Label;
     22 }
     23 
     24 // UninstallView implements the dialog that confirms Chrome uninstallation
     25 // and asks whether to delete Chrome profile. Also if currently Chrome is set
     26 // as default browser, it asks users whether to set another browser as default.
     27 class UninstallView : public views::ButtonListener,
     28                       public views::DialogDelegateView,
     29                       public ui::ComboboxModel {
     30  public:
     31   explicit UninstallView(int* user_selection,
     32                          const base::Closure& quit_closure,
     33                          bool show_delete_profile);
     34   virtual ~UninstallView();
     35 
     36   // Overridden form views::ButtonListener.
     37   virtual void ButtonPressed(views::Button* sender,
     38                              const ui::Event& event) OVERRIDE;
     39 
     40   // Overridden from views::DialogDelegateView:
     41   virtual bool Accept() OVERRIDE;
     42   virtual bool Cancel() OVERRIDE;
     43   virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
     44 
     45   // Overridden from views::WidgetDelegate:
     46   virtual string16 GetWindowTitle() const OVERRIDE;
     47 
     48   // Overridden from ui::ComboboxModel:
     49   virtual int GetItemCount() const OVERRIDE;
     50   virtual string16 GetItemAt(int index) OVERRIDE;
     51 
     52  private:
     53   typedef std::map<string16, string16> BrowsersMap;
     54 
     55   // Initializes the controls on the dialog.
     56   void SetupControls();
     57 
     58   views::Label* confirm_label_;
     59   bool show_delete_profile_;
     60   views::Checkbox* delete_profile_;
     61   views::Checkbox* change_default_browser_;
     62   views::Combobox* browsers_combo_;
     63   scoped_ptr<BrowsersMap> browsers_;
     64   int& user_selection_;
     65   base::Closure quit_closure_;
     66 
     67   DISALLOW_COPY_AND_ASSIGN(UninstallView);
     68 };
     69 
     70 #endif  // CHROME_BROWSER_UI_VIEWS_UNINSTALL_VIEW_H_
     71