| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // views::ButtonListener implementation: | 53 // views::ButtonListener implementation: |
| 54 virtual void ButtonPressed(views::Button* sender, | 54 virtual void ButtonPressed(views::Button* sender, |
| 55 const ui::Event& event) OVERRIDE; | 55 const ui::Event& event) OVERRIDE; |
| 56 | 56 |
| 57 // views::ContextMenuController implementation: | 57 // views::ContextMenuController implementation: |
| 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); |
| 64 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
| 65 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
| 66 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); |
| 67 |
| 63 typedef std::map<MediaGalleryPrefId, views::Checkbox*> CheckboxMap; | 68 typedef std::map<MediaGalleryPrefId, views::Checkbox*> CheckboxMap; |
| 64 typedef std::map<views::Checkbox*, MediaGalleryPrefInfo> NewCheckboxMap; | 69 typedef std::map<views::Checkbox*, MediaGalleryPrefInfo> NewCheckboxMap; |
| 65 | 70 |
| 71 void ButtonPressedAction(views::Button* sender); |
| 72 |
| 66 void InitChildViews(); | 73 void InitChildViews(); |
| 67 | 74 |
| 68 // Adds a checkbox or updates an existing checkbox. Returns true if a new one | 75 // Adds a checkbox or updates an existing checkbox. Returns true if a new one |
| 69 // was added. | 76 // was added. |
| 70 bool AddOrUpdateGallery(const MediaGalleryPrefInfo& gallery, | 77 bool AddOrUpdateGallery(const MediaGalleryPrefInfo& gallery, |
| 71 bool permitted, | 78 bool permitted, |
| 72 views::View* container, | 79 views::View* container, |
| 73 int trailing_vertical_space); | 80 int trailing_vertical_space); |
| 74 | 81 |
| 75 void ShowContextMenu(const gfx::Point& point, | 82 void ShowContextMenu(const gfx::Point& point, |
| 76 ui::MenuSourceType source_type, | 83 ui::MenuSourceType source_type, |
| 77 MediaGalleryPrefId id); | 84 MediaGalleryPrefId id); |
| 78 | 85 |
| 79 MediaGalleriesDialogController* controller_; | 86 MediaGalleriesDialogController* controller_; |
| 80 | 87 |
| 81 // The containing window (a weak pointer). | 88 // The containing window (a weak pointer). |
| 82 views::Widget* window_; | 89 views::Widget* window_; |
| 83 | 90 |
| 84 // The contents of the dialog. Owned by |window_|'s RootView. | 91 // The contents of the dialog. Owned by |window_|'s RootView except for tests. |
| 85 views::View* contents_; | 92 views::View* contents_; |
| 86 | 93 |
| 87 // A map from media gallery ID to views::Checkbox view. | 94 // A map from media gallery ID to views::Checkbox view. |
| 88 CheckboxMap checkbox_map_; | 95 CheckboxMap checkbox_map_; |
| 89 | 96 |
| 90 NewCheckboxMap new_checkbox_map_; | 97 NewCheckboxMap new_checkbox_map_; |
| 91 | 98 |
| 92 // Pointer to the button to add a new gallery. Owned by parent in | 99 // Pointer to the button to add a new gallery. Owned by parent in |
| 93 // the dialog views tree. | 100 // the dialog views tree. |
| 94 views::LabelButton* add_gallery_button_; | 101 views::LabelButton* add_gallery_button_; |
| 95 | 102 |
| 96 // This tracks whether the confirm button can be clicked. It starts as false | 103 // This tracks whether the confirm button can be clicked. It starts as false |
| 97 // if no checkboxes are ticked. After there is any interaction, or some | 104 // if no checkboxes are ticked. After there is any interaction, or some |
| 98 // checkboxes start checked, this will be true. | 105 // checkboxes start checked, this will be true. |
| 99 bool confirm_available_; | 106 bool confirm_available_; |
| 100 | 107 |
| 101 // True if the user has pressed accept. | 108 // True if the user has pressed accept. |
| 102 bool accepted_; | 109 bool accepted_; |
| 103 | 110 |
| 104 scoped_ptr<views::MenuRunner> context_menu_runner_; | 111 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 105 | 112 |
| 106 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | 113 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| 107 }; | 114 }; |
| 108 | 115 |
| 109 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
| OLD | NEW |