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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_
12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h"
14 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
15 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
16 #include "ui/base/gtk/gtk_signal.h"
17 #include "ui/gfx/scoped_gobject.h"
19 class MediaGalleriesDialogController
;
20 class MediaGalleriesDialogTest
;
22 // The media galleries configuration view for Gtk. It will immediately show
24 class MediaGalleriesDialogGtk
: public MediaGalleriesDialog
{
26 explicit MediaGalleriesDialogGtk(MediaGalleriesDialogController
* controller
);
27 virtual ~MediaGalleriesDialogGtk();
29 // MediaGalleriesDialog implementation:
30 virtual void UpdateGalleries() OVERRIDE
;
33 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk
, void, OnToggled
);
34 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk
, void, OnAddFolder
);
35 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk
, void, OnConfirm
);
36 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk
, void, OnCancel
);
39 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest
, InitializeCheckboxes
);
40 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest
, ToggleCheckboxes
);
41 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest
, UpdateAdds
);
42 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest
, ForgetDeletes
);
44 typedef std::map
<MediaGalleryPrefId
, GtkWidget
*> CheckboxMap
;
45 typedef std::map
<GtkWidget
*, MediaGalleryPrefInfo
> NewCheckboxMap
;
47 // Creates the widget hierarchy.
50 virtual void UpdateGalleryInContainer(const MediaGalleryPrefInfo
& gallery
,
52 GtkWidget
* checkbox_container
);
54 // Updates the state of the confirm button. It will be disabled when
55 void UpdateConfirmButtonState();
57 CHROMEGTK_CALLBACK_0(MediaGalleriesDialogGtk
, void, OnDestroy
);
59 MediaGalleriesDialogController
* controller_
;
62 // The root widget for the dialog.
63 ui::ScopedGObject
<GtkWidget
>::Type contents_
;
65 // The confirm button.
68 // A map from MediaGalleryPrefId to the GtkCheckButton that controls it.
69 CheckboxMap checkbox_map_
;
71 // Map for checkboxes of newly-added galleries to their MediaGalleryPrefInfo.
72 NewCheckboxMap new_checkbox_map_
;
74 // True if the user has pressed accept.
77 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogGtk
);
80 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_MEDIA_GALLERIES_DIALOG_GTK_H_