OLD | NEW |
(Empty) | |
| 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_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" |
| 12 #include "ui/views/window/dialog_delegate.h" |
| 13 |
| 14 class ConstrainedWindowViews; |
| 15 |
| 16 namespace views { |
| 17 class Checkbox; |
| 18 } |
| 19 |
| 20 namespace chrome { |
| 21 |
| 22 // The media galleries configuration view for Views. It will immediately show |
| 23 // upon construction. |
| 24 class MediaGalleriesDialogViews : public MediaGalleriesDialog, |
| 25 public views::DialogDelegate, |
| 26 public views::ButtonListener { |
| 27 public: |
| 28 explicit MediaGalleriesDialogViews( |
| 29 MediaGalleriesDialogController* controller); |
| 30 virtual ~MediaGalleriesDialogViews(); |
| 31 |
| 32 // MediaGalleriesDialog implementation: |
| 33 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 34 bool permitted) OVERRIDE; |
| 35 |
| 36 // views::DialogDelegate implementation: |
| 37 virtual void DeleteDelegate() OVERRIDE; |
| 38 virtual views::Widget* GetWidget() OVERRIDE; |
| 39 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 40 virtual views::View* GetContentsView() OVERRIDE; |
| 41 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 42 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
| 43 virtual bool Cancel() OVERRIDE; |
| 44 virtual bool Accept() OVERRIDE; |
| 45 |
| 46 // views::ButtonListener implementation: |
| 47 virtual void ButtonPressed(views::Button* sender, |
| 48 const ui::Event& event) OVERRIDE; |
| 49 |
| 50 private: |
| 51 typedef std::map<const MediaGalleryPrefInfo*, views::Checkbox*> CheckboxMap; |
| 52 |
| 53 void InitChildViews(); |
| 54 |
| 55 // Adds a checkbox or updates an existing checkbox. Returns true if a new one |
| 56 // was added. |
| 57 bool AddOrUpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 58 bool permitted); |
| 59 |
| 60 MediaGalleriesDialogController* controller_; |
| 61 |
| 62 // The constrained window (a weak pointer). |
| 63 ConstrainedWindowViews* window_; |
| 64 |
| 65 // The contents of the dialog. Owned by |window_|'s RootView. |
| 66 views::View* contents_; |
| 67 |
| 68 // A map from media gallery to views::Checkbox view. |
| 69 CheckboxMap checkbox_map_; |
| 70 |
| 71 views::View* checkbox_container_; |
| 72 views::Button* add_gallery_; |
| 73 |
| 74 // This tracks whether the confirm button can be clicked. It starts as false |
| 75 // if no checkboxes are ticked. After there is any interaction, or some |
| 76 // checkboxes start checked, this will be true. |
| 77 bool confirm_available_; |
| 78 |
| 79 // True if the user has pressed accept. |
| 80 bool accepted_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| 83 }; |
| 84 |
| 85 } // namespace chrome |
| 86 |
| 87 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
OLD | NEW |