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