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 Gtk. 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 string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 38 virtual bool Cancel() OVERRIDE; |
| 39 virtual bool Accept() OVERRIDE; |
| 40 |
| 41 // views::WidgetDelegate implementation: |
| 42 virtual views::View* GetContentsView() OVERRIDE; |
| 43 virtual views::Widget* GetWidget() OVERRIDE; |
| 44 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 45 virtual void DeleteDelegate() OVERRIDE; |
| 46 |
| 47 // views::ButtonListener implementation: |
| 48 virtual void ButtonPressed( |
| 49 views::Button* sender, const views::Event& event) OVERRIDE; |
| 50 |
| 51 private: |
| 52 typedef std::map<const MediaGalleryPrefInfo*, views::Checkbox*> CheckboxMap; |
| 53 |
| 54 void InitChildViews(); |
| 55 |
| 56 // Adds a checkbox or updates an existing checkbox. Returns true if a new one |
| 57 // was added. |
| 58 bool AddOrUpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 59 bool permitted); |
| 60 |
| 61 MediaGalleriesDialogController* controller_; |
| 62 |
| 63 ConstrainedWindowViews* window_; |
| 64 |
| 65 views::View* contents_; |
| 66 |
| 67 views::View* checkbox_container_; |
| 68 |
| 69 // A map from media gallery to views::Checkbox view. |
| 70 CheckboxMap checkbox_map_; |
| 71 |
| 72 views::Button* add_gallery_; |
| 73 |
| 74 // True if the user has pressed accept. |
| 75 bool accepted_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| 78 }; |
| 79 |
| 80 } // namespace chrome |
| 81 |
| 82 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
OLD | NEW |