OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void ShowContextMenuForView(views::View* source, | 58 virtual void ShowContextMenuForView(views::View* source, |
59 const gfx::Point& point, | 59 const gfx::Point& point, |
60 ui::MenuSourceType source_type) OVERRIDE; | 60 ui::MenuSourceType source_type) OVERRIDE; |
61 | 61 |
62 private: | 62 private: |
63 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); | 63 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); |
64 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); | 64 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
65 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); | 65 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
66 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); | 66 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); |
67 | 67 |
68 typedef std::map<GalleryDialogId, MediaGalleryCheckboxView*> CheckboxMap; | 68 typedef std::map<MediaGalleryPrefId, MediaGalleryCheckboxView*> CheckboxMap; |
69 | 69 |
70 void InitChildViews(); | 70 void InitChildViews(); |
71 | 71 |
72 // Adds a checkbox or updates an existing checkbox. Returns true if a new one | 72 // Adds a checkbox or updates an existing checkbox. Returns true if a new one |
73 // was added. | 73 // was added. |
74 bool AddOrUpdateGallery( | 74 bool AddOrUpdateGallery( |
75 const MediaGalleriesDialogController::GalleryPermission& gallery, | 75 const MediaGalleriesDialogController::Entry& gallery, |
76 views::View* container, | 76 views::View* container, |
77 int trailing_vertical_space); | 77 int trailing_vertical_space); |
78 | 78 |
79 void ShowContextMenu(const gfx::Point& point, | 79 void ShowContextMenu(const gfx::Point& point, |
80 ui::MenuSourceType source_type, | 80 ui::MenuSourceType source_type, |
81 GalleryDialogId id); | 81 MediaGalleryPrefId id); |
82 | 82 |
83 // Whether |controller_| has a valid WebContents or not. | 83 // Whether |controller_| has a valid WebContents or not. |
84 // In unit tests, it may not. | 84 // In unit tests, it may not. |
85 bool ControllerHasWebContents() const; | 85 bool ControllerHasWebContents() const; |
86 | 86 |
87 MediaGalleriesDialogController* controller_; | 87 MediaGalleriesDialogController* controller_; |
88 | 88 |
89 // The contents of the dialog. Owned by the view hierarchy, except in tests. | 89 // The contents of the dialog. Owned by the view hierarchy, except in tests. |
90 views::View* contents_; | 90 views::View* contents_; |
91 | 91 |
92 // A map from gallery ID to views::Checkbox view. | 92 // A map from gallery ID to views::Checkbox view. |
93 CheckboxMap checkbox_map_; | 93 CheckboxMap checkbox_map_; |
94 | 94 |
95 // Pointer to the button to add a new gallery. Owned by parent in | 95 // Pointer to the controller specific auxiliary button, NULL otherwise. |
96 // the dialog views tree. | 96 // Owned by parent in the dialog views tree. |
97 views::LabelButton* add_gallery_button_; | 97 views::LabelButton* auxiliary_button_; |
98 | 98 |
99 // This tracks whether the confirm button can be clicked. It starts as false | 99 // This tracks whether the confirm button can be clicked. It starts as false |
100 // if no checkboxes are ticked. After there is any interaction, or some | 100 // if no checkboxes are ticked. After there is any interaction, or some |
101 // checkboxes start checked, this will be true. | 101 // checkboxes start checked, this will be true. |
102 bool confirm_available_; | 102 bool confirm_available_; |
103 | 103 |
104 // True if the user has pressed accept. | 104 // True if the user has pressed accept. |
105 bool accepted_; | 105 bool accepted_; |
106 | 106 |
107 scoped_ptr<views::MenuRunner> context_menu_runner_; | 107 scoped_ptr<views::MenuRunner> context_menu_runner_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | 109 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 112 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
OLD | NEW |