#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_
#include <map>
#include "base/compiler_specific.h"
#include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
#include "ui/views/context_menu_controller.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/window/dialog_delegate.h"
namespace views {
class Checkbox;
class LabelButton;
class MenuRunner;
class Widget;
}
class MediaGalleryCheckboxView;
class MediaGalleriesDialogViews : public MediaGalleriesDialog,
public views::ButtonListener,
public views::ContextMenuController,
public views::DialogDelegate {
public:
explicit MediaGalleriesDialogViews(
MediaGalleriesDialogController* controller);
virtual ~MediaGalleriesDialogViews();
virtual void UpdateGalleries() OVERRIDE;
virtual base::string16 GetWindowTitle() const OVERRIDE;
virtual void DeleteDelegate() OVERRIDE;
virtual views::Widget* GetWidget() OVERRIDE;
virtual const views::Widget* GetWidget() const OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
virtual base::string16 GetDialogButtonLabel(
ui::DialogButton button) const OVERRIDE;
virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
virtual ui::ModalType GetModalType() const OVERRIDE;
virtual views::View* CreateExtraView() OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
virtual void ShowContextMenuForView(views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) OVERRIDE;
private:
FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes);
FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes);
FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds);
FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes);
typedef std::map<MediaGalleryPrefId, MediaGalleryCheckboxView*> CheckboxMap;
typedef std::map<MediaGalleryCheckboxView*, MediaGalleryPrefInfo>
NewCheckboxMap;
void InitChildViews();
bool AddOrUpdateGallery(const MediaGalleryPrefInfo& gallery,
bool permitted,
views::View* container,
int trailing_vertical_space);
void ShowContextMenu(const gfx::Point& point,
ui::MenuSourceType source_type,
MediaGalleryPrefId id);
bool ControllerHasWebContents() const;
MediaGalleriesDialogController* controller_;
views::Widget* window_;
views::View* contents_;
CheckboxMap checkbox_map_;
NewCheckboxMap new_checkbox_map_;
views::LabelButton* add_gallery_button_;
bool confirm_available_;
bool accepted_;
scoped_ptr<views::MenuRunner> context_menu_runner_;
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews);
};
#endif