Chromium Code Reviews| 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 containing window (a weak pointer). | 89 // The containing window (a weak pointer). |
| 90 views::Widget* window_; | 90 views::Widget* window_; |
| 91 | 91 |
| 92 // The contents of the dialog. Owned by |window_|'s RootView except for tests. | 92 // The contents of the dialog. Owned by |window_|'s RootView except for tests. |
| 93 views::View* contents_; | 93 views::View* contents_; |
| 94 | 94 |
| 95 // A map from gallery ID to views::Checkbox view. | 95 // A map from gallery ID to views::Checkbox view. |
| 96 CheckboxMap checkbox_map_; | 96 CheckboxMap checkbox_map_; |
| 97 | 97 |
| 98 // Pointer to the button to add a new gallery. Owned by parent in | 98 // Pointer to the button to add a new gallery. Owned by parent in |
|
Lei Zhang
2014/06/05 07:56:25
update comment
vandebo (ex-Chrome)
2014/06/05 19:25:30
Done.
| |
| 99 // the dialog views tree. | 99 // the dialog views tree. |
| 100 views::LabelButton* add_gallery_button_; | 100 views::LabelButton* auxilliary_button_; |
| 101 | 101 |
| 102 // This tracks whether the confirm button can be clicked. It starts as false | 102 // This tracks whether the confirm button can be clicked. It starts as false |
| 103 // if no checkboxes are ticked. After there is any interaction, or some | 103 // if no checkboxes are ticked. After there is any interaction, or some |
| 104 // checkboxes start checked, this will be true. | 104 // checkboxes start checked, this will be true. |
| 105 bool confirm_available_; | 105 bool confirm_available_; |
| 106 | 106 |
| 107 // True if the user has pressed accept. | 107 // True if the user has pressed accept. |
| 108 bool accepted_; | 108 bool accepted_; |
| 109 | 109 |
| 110 scoped_ptr<views::MenuRunner> context_menu_runner_; | 110 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | 112 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 115 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
| OLD | NEW |