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; | |
Peter Kasting
2012/08/14 18:44:01
Nit: Now that you've moved these declarations, als
| |
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. This is a weak pointer, it is owned by its | |
66 // its parent view. | |
Peter Kasting
2012/08/14 18:44:01
Nit: its its
It's not actually obvious what the p
Evan Stade
2012/08/14 21:07:28
you passed the test!
| |
67 views::View* contents_; | |
68 | |
69 // A map from media gallery to views::Checkbox view. | |
70 CheckboxMap checkbox_map_; | |
71 | |
72 views::View* checkbox_container_; | |
73 views::Button* add_gallery_; | |
74 | |
75 // This tracks whether the confirm button can be clicked. It starts as false | |
76 // if no checkboxes are ticked. After there is any interaction, or some | |
77 // checkboxes start checked, this will be true. | |
78 bool confirm_available_; | |
79 | |
80 // True if the user has pressed accept. | |
81 bool accepted_; | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | |
84 }; | |
85 | |
86 } // namespace chrome | |
87 | |
88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | |
OLD | NEW |