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

Unified Diff: chrome/browser/ui/views/website_settings_popup_view.h

Issue 10456017: Add WebsiteSettingsUI for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/website_settings_popup_view.h
diff --git a/chrome/browser/ui/views/website_settings_popup_view.h b/chrome/browser/ui/views/website_settings_popup_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..aadcacf59dd5ac395868e5b59be3fcaf185ea20b
--- /dev/null
+++ b/chrome/browser/ui/views/website_settings_popup_view.h
@@ -0,0 +1,173 @@
+// 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_WEBSITE_SETTINGS_POPUP_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_POPUP_VIEW_H_
+#pragma once
+
+#include "chrome/browser/ui/website_settings_ui.h"
+#include "ui/base/models/combobox_model.h"
+#include "ui/views/bubble/bubble_delegate.h"
+#include "ui/views/controls/combobox/combobox_listener.h"
+#include "ui/views/controls/link_listener.h"
+#include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h"
+#include "ui/views/view.h"
+
+class PopupHeader;
+class Profile;
+class TabContentsWrapper;
+namespace views {
Finnur 2012/05/30 11:20:04 nit: I'd put a line break before this line...
markusheintz_ 2012/06/05 17:02:12 Done.
+class Combobox;
+class Link;
+class Label;
+class TabbedPane;
+} // namespace views
+
+// |PopupHeader| is the UI element (view) that represents the header of the
+// |WebsiteSettingsPopupView|.
+class PopupHeader : public views::View {
Finnur 2012/05/30 11:20:04 Does this need to be defined in the .h file?
markusheintz_ 2012/06/05 17:02:12 I moved the class definitions back to the .cc file
+ public:
+ PopupHeader();
+ virtual ~PopupHeader();
+
+ void SetIdentityName(string16 identity);
Finnur 2012/05/30 11:20:04 Document all members and functions (here and class
markusheintz_ 2012/06/05 17:02:12 Done.
+
+ void SetIdentityStatus(string16 status);
+
+ // View implementation.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+
+ private:
+ views::Label* name_;
+ views::Label* status_;
+
+ DISALLOW_COPY_AND_ASSIGN(PopupHeader);
+};
+
+// A |ComboboxModel| implementation that is used for |Combobox|es that allow to
+// select a setting for a given site permission.
Finnur 2012/05/30 11:20:04 wording: allow to select -> allow selecting
markusheintz_ 2012/06/05 17:02:12 Done.
+class PermissionComboboxModel : public ui::ComboboxModel {
Finnur 2012/05/30 11:20:04 Same here, does it need to be in the .h file?
markusheintz_ 2012/06/05 17:02:12 Same as above in line 29.
+ public:
+ // Creates a combobox model that provides all possible settings for the given
+ // |site_permission|.
+ PermissionComboboxModel(ContentSettingsType site_permission,
+ ContentSetting default_setting);
+ virtual ~PermissionComboboxModel();
+
+ // Returns the setting for the given |index|.
+ ContentSetting GetSettingAt(int index) const;
+
+ // Returns the site permission for which the combobox model provides
+ // settings.
+ ContentSettingsType site_permission() const {
+ return site_permission_;
+ }
+
+ // ui::ComboboxModel implementations.
+ virtual int GetItemCount() const OVERRIDE;
+ virtual string16 GetItemAt(int index) OVERRIDE;
+
+ private:
+ // The site permission (the |ContentSettingsType|) for which the combobox
+ // model provides settings.
+ ContentSettingsType site_permission_;
+
+ // The global default setting for the |site_permission_|.
+ ContentSetting default_setting_;
+
+ // All possible valid setting for the |site_permission_|.
+ std::vector<ContentSetting> settings_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionComboboxModel);
+};
+
+// Views implementation of the website settings UI. The website settings UI is
+// displayed in a popup that is positioned relative the an anchor element
Finnur 2012/05/30 11:20:04 nit: 'the' or 'an', which is it? Also, missing per
markusheintz_ 2012/06/05 17:02:12 Done.
+class WebsiteSettingsPopupView : public WebsiteSettingsUI,
+ public views::BubbleDelegateView,
+ public views::ComboboxListener,
+ public views::LinkListener,
+ public views::TabbedPaneListener {
+ public:
+ WebsiteSettingsPopupView(views::View* anchor_view,
+ Profile* profile,
+ TabContentsWrapper* wrapper);
+
+ virtual ~WebsiteSettingsPopupView();
+
+ // WebsiteSettingsUI implementations.
+ virtual void SetPresenter(WebsiteSettings* presenter) OVERRIDE;
+ virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE;
+ virtual void SetPermissionInfo(
+ const PermissionInfoList& permission_info_list) OVERRIDE;
+ virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE;
+ virtual void SetFirstVisit(const string16& first_visit) OVERRIDE;
+
+ // views::View implementation.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+
+ // views::BubbleDelegate implementations.
+ virtual gfx::Rect GetAnchorRect() OVERRIDE;
+
+ // views::ComboboxListener implementation.
+ virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE;
+
+ // LinkListener implementation.
+ virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
+
+ // views::TabbedPaneListener implementations.
+ virtual void TabSelectedAt(int index) OVERRIDE;
+
+ private:
+ // Each tab contains several sections with a |headline| followed by the
+ // section |contents| and an optional |link|. This method creates a section
+ // for the given |headline|, |contents| and |link|. |link| can be NULL if the
+ // section should not contain a link.
+ views::View* CreateSection(string16 headline,
+ views::View* contents,
+ views::Link* link);
+
+ // Creates a single row for the "Permissions" section from the "Permissions"
+ // tab. Such a row contains a |permissions_label| with the name of the
+ // permission and a |combobox| that allows to select setting for the given
+ // permission.
+ views::View* CreatePermissionRow(views::Label* permission_label,
+ views::Combobox* combobox);
+
+ // Creates the contents of the "Permissions" tab.
+ views::View* CreatePermissionsTab();
+
+ // Creates the contents of the "Identity" tab.
+ views::View* CreateIdentityTab();
+
+ // Creates a multiline text label that is initialized with the given |text|.
+ views::Label* CreateTextLabel(string16 text);
Finnur 2012/05/30 11:20:04 These Create functions... can you annotate them wi
markusheintz_ 2012/06/05 17:02:12 Done.
Finnur 2012/06/06 11:55:50 Actually, you should probably also document the fa
markusheintz_ 2012/06/06 13:47:03 Done. I also added a comment to the methods above.
+
+ TabContentsWrapper* tab_contents_wrapper_;
+
+ // The presenter that controlls the Website Settings UI.
+ WebsiteSettings* presenter_;
+
+ PopupHeader* header_;
+
+ // The |TabbedPane| that contains the tabs of the Website Settings UI.
+ views::TabbedPane* tabbed_pane_;
+
+ // The view that contains the contents of the "Cookies and Site data" section
+ // from the "Permissions" tab.
+ views::View* site_data_content_;
+ // The link that opend the "Cookies" dialog.
+ views::Link* cookie_dialog_link_;
+ // The view that contains the contents of the "Permissions" section from the
+ // "Permissions" tab.
+ views::View* permissions_content_;
+
+ views::Label* identity_info_text_;
+ views::Label* connection_info_text_;
+ views::Label* page_info_text_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_POPUP_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698