Chromium Code Reviews| Index: chrome/browser/ui/views/extensions/media_galleries_dialog_views.h |
| diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.h b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4b7ce747a8ba9cccb818af21113574c0e47d5537 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.h |
| @@ -0,0 +1,91 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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_gallery/media_galleries_dialog_controller.h" |
| +#include "ui/views/window/dialog_delegate.h" |
| + |
| +class ConstrainedWindowViews; |
| + |
| +namespace views { |
| +class Checkbox; |
| +} |
| + |
| +namespace chrome { |
| + |
| +// The media galleries configuration view for Gtk. It will immediately show |
|
Peter Kasting
2012/08/11 23:09:14
Gtk?
Evan Stade
2012/08/13 23:10:30
Done.
|
| +// upon construction. |
| +class MediaGalleriesDialogViews : public MediaGalleriesDialog, |
| + public views::DialogDelegate, |
| + public views::ButtonListener { |
| + public: |
| + explicit MediaGalleriesDialogViews( |
| + MediaGalleriesDialogController* controller); |
| + virtual ~MediaGalleriesDialogViews(); |
| + |
| + // MediaGalleriesDialog implementation: |
| + virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| + bool permitted) OVERRIDE; |
| + |
| + // views::DialogDelegate implementation: |
| + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
| + virtual bool Cancel() OVERRIDE; |
| + virtual bool Accept() OVERRIDE; |
| + |
| + // views::WidgetDelegate implementation: |
|
Peter Kasting
2012/08/11 23:09:14
Nit: This class doesn't directly inherit from Widg
Evan Stade
2012/08/13 23:10:30
Done.
|
| + virtual views::View* GetContentsView() OVERRIDE; |
| + virtual views::Widget* GetWidget() OVERRIDE; |
| + virtual const views::Widget* GetWidget() const OVERRIDE; |
| + virtual void DeleteDelegate() OVERRIDE; |
| + |
| + // views::ButtonListener implementation: |
| + virtual void ButtonPressed( |
| + views::Button* sender, const ui::Event& event) OVERRIDE; |
|
Peter Kasting
2012/08/11 23:09:14
Nit: First arg on previous line
Evan Stade
2012/08/13 23:10:30
Done.
|
| + |
| + private: |
| + typedef std::map<const MediaGalleryPrefInfo*, views::Checkbox*> CheckboxMap; |
| + |
| + void InitChildViews(); |
| + |
| + // Adds a checkbox or updates an existing checkbox. Returns true if a new one |
| + // was added. |
| + bool AddOrUpdateGallery(const MediaGalleryPrefInfo* gallery, |
| + bool permitted); |
| + |
| + // Enables the confirm button (see |confirm_available_|). |
| + void EnableConfirm(); |
| + |
| + MediaGalleriesDialogController* controller_; |
| + |
|
Peter Kasting
2012/08/11 23:09:14
Nit: No need for blank lines for members without c
Evan Stade
2012/08/13 23:10:30
I originally did not document that because it is d
Peter Kasting
2012/08/14 18:44:01
I read constrained_window_views.h but it doesn't s
|
| + ConstrainedWindowViews* window_; |
| + |
| + views::View* contents_; |
| + |
| + views::View* checkbox_container_; |
| + |
| + // A map from media gallery to views::Checkbox view. |
| + CheckboxMap checkbox_map_; |
| + |
| + views::Button* add_gallery_; |
| + |
| + // This tracks whether the confirm button can be clicked. It starts as false |
| + // if no checkboxes are ticked. After there is any interaction, or some |
| + // checkboxes start checked, this will be true. |
| + bool confirm_available_; |
| + |
| + // True if the user has pressed accept. |
| + bool accepted_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogViews); |
| +}; |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_MEDIA_GALLERIES_DIALOG_VIEWS_H_ |