OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_SCAN_RESULT_DIALOG_VI
EWS_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_VI
EWS_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "chrome/browser/media_galleries/media_galleries_scan_result_dialog_cont
roller.h" | |
12 #include "ui/views/context_menu_controller.h" | |
13 #include "ui/views/controls/button/button.h" | |
14 #include "ui/views/window/dialog_delegate.h" | |
15 | |
16 namespace views { | |
17 class Checkbox; | |
18 class ImageButton; | |
19 class Label; | |
20 class MenuRunner; | |
21 class Widget; | |
22 } | |
23 | |
24 class MediaGalleryCheckboxView; | |
25 | |
26 // The media galleries scan result view for Views. It will immediately show | |
27 // upon construction. | |
28 class MediaGalleriesScanResultDialogViews | |
29 : public MediaGalleriesScanResultDialog, | |
30 public views::ButtonListener, | |
31 public views::ContextMenuController, | |
32 public views::DialogDelegate { | |
33 public: | |
34 explicit MediaGalleriesScanResultDialogViews( | |
35 MediaGalleriesScanResultDialogController* controller); | |
36 virtual ~MediaGalleriesScanResultDialogViews(); | |
37 | |
38 // MediaGalleriesScanResultDialog implementation: | |
39 virtual void UpdateResults() OVERRIDE; | |
40 | |
41 // views::DialogDelegate implementation: | |
42 virtual base::string16 GetWindowTitle() const OVERRIDE; | |
43 virtual void DeleteDelegate() OVERRIDE; | |
44 virtual views::Widget* GetWidget() OVERRIDE; | |
45 virtual const views::Widget* GetWidget() const OVERRIDE; | |
46 virtual views::View* GetContentsView() OVERRIDE; | |
47 virtual base::string16 GetDialogButtonLabel( | |
48 ui::DialogButton button) const OVERRIDE; | |
49 virtual ui::ModalType GetModalType() const OVERRIDE; | |
50 virtual bool Cancel() OVERRIDE; | |
51 virtual bool Accept() OVERRIDE; | |
52 | |
53 // views::ButtonListener implementation: | |
54 virtual void ButtonPressed(views::Button* sender, | |
55 const ui::Event& event) OVERRIDE; | |
56 | |
57 // views::ContextMenuController implementation: | |
58 virtual void ShowContextMenuForView(views::View* source, | |
59 const gfx::Point& point, | |
60 ui::MenuSourceType source_type) OVERRIDE; | |
61 | |
62 private: | |
63 typedef std::map<MediaGalleryPrefId, MediaGalleryCheckboxView*> | |
64 GalleryViewMap; | |
65 | |
66 void InitChildViews(); | |
67 | |
68 // Adds a checkbox or updates an existing checkbox. Returns true if a new one | |
69 // was added. | |
70 bool AddOrUpdateScanResult(const MediaGalleryPrefInfo& gallery, | |
71 bool selected, | |
72 views::View* container, | |
73 int trailing_vertical_space); | |
74 | |
75 void ShowContextMenu(const gfx::Point& point, | |
76 ui::MenuSourceType source_type, | |
77 MediaGalleryPrefId id); | |
78 | |
79 // MediaGalleriesScanResultDialog implementation: | |
80 virtual void AcceptDialogForTesting() OVERRIDE; | |
81 | |
82 MediaGalleriesScanResultDialogController* controller_; | |
83 | |
84 // The contents of the dialog. Owned by the view hierarchy. | |
85 views::View* contents_; | |
86 | |
87 // A map from media gallery ID to the view elements for each gallery. | |
88 GalleryViewMap gallery_view_map_; | |
89 | |
90 // True if the user has pressed accept. | |
91 bool accepted_; | |
92 | |
93 scoped_ptr<views::MenuRunner> context_menu_runner_; | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogViews); | |
96 }; | |
97 | |
98 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG
_VIEWS_H_ | |
OLD | NEW |