| 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" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" | 13 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" |
| 14 #include "ui/views/context_menu_controller.h" | 14 #include "ui/views/context_menu_controller.h" |
| 15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
| 16 #include "ui/views/window/dialog_delegate.h" | 16 #include "ui/views/window/dialog_delegate.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 class Checkbox; | 19 class Checkbox; |
| 20 class LabelButton; | 20 class LabelButton; |
| 21 class MenuModelAdapter; | |
| 22 class MenuRunner; | 21 class MenuRunner; |
| 23 class Widget; | 22 class Widget; |
| 24 } | 23 } |
| 25 | 24 |
| 26 class MediaGalleryCheckboxView; | 25 class MediaGalleryCheckboxView; |
| 27 | 26 |
| 28 // The media galleries configuration view for Views. It will immediately show | 27 // The media galleries configuration view for Views. It will immediately show |
| 29 // upon construction. | 28 // upon construction. |
| 30 class MediaGalleriesDialogViews : public MediaGalleriesDialog, | 29 class MediaGalleriesDialogViews : public MediaGalleriesDialog, |
| 31 public views::ButtonListener, | 30 public views::ButtonListener, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int trailing_vertical_space); | 80 int trailing_vertical_space); |
| 82 | 81 |
| 83 void ShowContextMenu(const gfx::Point& point, | 82 void ShowContextMenu(const gfx::Point& point, |
| 84 ui::MenuSourceType source_type, | 83 ui::MenuSourceType source_type, |
| 85 MediaGalleryPrefId id); | 84 MediaGalleryPrefId id); |
| 86 | 85 |
| 87 // Whether |controller_| has a valid WebContents or not. | 86 // Whether |controller_| has a valid WebContents or not. |
| 88 // In unit tests, it may not. | 87 // In unit tests, it may not. |
| 89 bool ControllerHasWebContents() const; | 88 bool ControllerHasWebContents() const; |
| 90 | 89 |
| 91 // Callback for MenuModelAdapter. | 90 // Callback for MenuRunner. |
| 92 void OnMenuClosed(); | 91 void OnMenuClosed(); |
| 93 | 92 |
| 94 MediaGalleriesDialogController* controller_; | 93 MediaGalleriesDialogController* controller_; |
| 95 | 94 |
| 96 // The contents of the dialog. Owned by the view hierarchy, except in tests. | 95 // The contents of the dialog. Owned by the view hierarchy, except in tests. |
| 97 views::View* contents_; | 96 views::View* contents_; |
| 98 | 97 |
| 99 // A map from gallery ID to views::Checkbox view. | 98 // A map from gallery ID to views::Checkbox view. |
| 100 CheckboxMap checkbox_map_; | 99 CheckboxMap checkbox_map_; |
| 101 | 100 |
| 102 // Pointer to the controller specific auxiliary button, NULL otherwise. | 101 // Pointer to the controller specific auxiliary button, NULL otherwise. |
| 103 // Owned by parent in the dialog views tree. | 102 // Owned by parent in the dialog views tree. |
| 104 views::LabelButton* auxiliary_button_; | 103 views::LabelButton* auxiliary_button_; |
| 105 | 104 |
| 106 // This tracks whether the confirm button can be clicked. It starts as false | 105 // This tracks whether the confirm button can be clicked. It starts as false |
| 107 // if no checkboxes are ticked. After there is any interaction, or some | 106 // if no checkboxes are ticked. After there is any interaction, or some |
| 108 // checkboxes start checked, this will be true. | 107 // checkboxes start checked, this will be true. |
| 109 bool confirm_available_; | 108 bool confirm_available_; |
| 110 | 109 |
| 111 // True if the user has pressed accept. | 110 // True if the user has pressed accept. |
| 112 bool accepted_; | 111 bool accepted_; |
| 113 | 112 |
| 114 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; | |
| 115 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 113 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
| 116 | 114 |
| 117 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); | 115 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| 118 }; | 116 }; |
| 119 | 117 |
| 120 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ | 118 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |
| OLD | NEW |