Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: chrome/browser/ui/views/extensions/media_galleries_dialog_views.h

Issue 10828166: media galleries config dialog on views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..baf3a3b441b5b1447682535d923900098ba19037
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.h
@@ -0,0 +1,87 @@
+// 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 Views. It will immediately show
+// 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 void DeleteDelegate() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ 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::ButtonListener implementation:
+ virtual void ButtonPressed(views::Button* sender,
+ const ui::Event& event) OVERRIDE;
+
+ 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);
+
+ MediaGalleriesDialogController* controller_;
+
+ // The constrained window (a weak pointer).
+ ConstrainedWindowViews* window_;
+
+ // The contents of the dialog. Owned by |window_|'s RootView.
+ views::View* contents_;
+
+ // A map from media gallery to views::Checkbox view.
+ CheckboxMap checkbox_map_;
+
+ views::View* checkbox_container_;
+ 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_
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.h ('k') | chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698