Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_POPUP_VIEW_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_POPUP_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | |
| 14 #include "ui/base/models/combobox_model.h" | |
| 15 #include "ui/views/bubble/bubble_delegate.h" | |
| 16 #include "ui/views/controls/combobox/combobox_listener.h" | |
| 17 #include "ui/views/controls/link_listener.h" | |
| 18 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" | |
| 19 | |
| 20 class GURL; | |
| 21 class PopupHeader; | |
| 22 class Profile; | |
| 23 class TabContentsWrapper; | |
| 24 | |
| 25 namespace content { | |
| 26 struct SSLStatus; | |
| 27 } | |
| 28 | |
| 29 namespace website_settings { | |
| 30 class PermissionComboboxModel; | |
| 31 } | |
| 32 | |
| 33 namespace views { | |
| 34 class Combobox; | |
| 35 class Link; | |
| 36 class Label; | |
| 37 class TabbedPane; | |
| 38 class View; | |
| 39 } | |
| 40 | |
| 41 // The views implementation of the website settings UI. | |
| 42 class WebsiteSettingsPopupView : public WebsiteSettingsUI, | |
| 43 public views::BubbleDelegateView, | |
| 44 public views::ComboboxListener, | |
| 45 public views::LinkListener, | |
| 46 public views::TabbedPaneListener { | |
| 47 public: | |
| 48 virtual ~WebsiteSettingsPopupView(); | |
| 49 | |
| 50 static void ShowPopup(views::View* anchor_view, | |
| 51 Profile* profile, | |
| 52 TabContentsWrapper* tab_contents, | |
|
markusheintz_
2012/06/07 20:10:38
Since there is an effort going on to rename TabCon
| |
| 53 const GURL& gurl, | |
| 54 const content::SSLStatus& ssl); | |
| 55 | |
| 56 private: | |
| 57 WebsiteSettingsPopupView(views::View* anchor_view, | |
| 58 Profile* profile, | |
| 59 TabContentsWrapper* tab_contents, | |
| 60 const GURL& url, | |
| 61 const content::SSLStatus& ssl); | |
| 62 | |
| 63 // WebsiteSettingsUI implementations. | |
| 64 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; | |
| 65 virtual void SetPermissionInfo( | |
| 66 const PermissionInfoList& permission_info_list) OVERRIDE; | |
| 67 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; | |
| 68 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; | |
| 69 | |
| 70 // views::View implementation. | |
| 71 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 72 | |
| 73 // views::BubbleDelegate implementations. | |
| 74 virtual gfx::Rect GetAnchorRect() OVERRIDE; | |
| 75 | |
| 76 // views::ComboboxListener implementation. | |
| 77 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; | |
| 78 | |
| 79 // LinkListener implementation. | |
| 80 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
| 81 | |
| 82 // views::TabbedPaneListener implementations. | |
| 83 virtual void TabSelectedAt(int index) OVERRIDE; | |
| 84 | |
| 85 // Each tab contains several sections with a |headline| followed by the | |
| 86 // section |contents| and an optional |link|. This method creates a section | |
| 87 // for the given |headline|, |contents| and |link|. |link| can be NULL if the | |
| 88 // section should not contain a link. | |
| 89 views::View* CreateSection(const string16& headline, | |
| 90 views::View* contents, | |
| 91 views::Link* link) WARN_UNUSED_RESULT; | |
| 92 | |
| 93 // Creates a single row for the "Permissions" section from the "Permissions" | |
| 94 // tab. Such a row contains a |permissions_label| with the name of the | |
| 95 // permission and a |combobox| that allows to select setting for the given | |
| 96 // permission. The ownership of the returned view is transferred to the | |
| 97 // caller. | |
| 98 views::View* CreatePermissionRow( | |
| 99 views::Label* permission_label, | |
| 100 views::Combobox* combobox) WARN_UNUSED_RESULT; | |
| 101 | |
| 102 // Creates the contents of the "Permissions" tab. The ownership of the | |
| 103 // returned view is transferred to the caller. | |
| 104 views::View* CreatePermissionsTab() WARN_UNUSED_RESULT; | |
| 105 | |
| 106 // Creates the contents of the "Identity" tab. The ownership of the returned | |
| 107 // view is transferred to the caller. | |
| 108 views::View* CreateIdentityTab() WARN_UNUSED_RESULT; | |
| 109 | |
| 110 // Creates a multiline text label that is initialized with the given |text|. | |
| 111 // The ownership of the returned label is transferred to the caller. | |
| 112 views::Label* CreateTextLabel(const string16& text) WARN_UNUSED_RESULT; | |
| 113 | |
| 114 // The tab contents of the current tab. The popup can't live longer than a | |
| 115 // tab. | |
| 116 TabContentsWrapper* tab_contents_wrapper_; // Weak pointer. | |
| 117 | |
| 118 // The presenter that controlls the Website Settings UI. | |
| 119 scoped_ptr<WebsiteSettings> presenter_; | |
| 120 | |
| 121 // The view |PopupHeader| is owned by the popup contents view. | |
| 122 PopupHeader* header_; | |
| 123 | |
| 124 // The |TabbedPane| that contains the tabs of the Website Settings UI. | |
| 125 views::TabbedPane* tabbed_pane_; | |
| 126 | |
| 127 // The view that contains the contents of the "Cookies and Site data" section | |
| 128 // from the "Permissions" tab. | |
| 129 views::View* site_data_content_; | |
| 130 // The link that opend the "Cookies" dialog. | |
| 131 views::Link* cookie_dialog_link_; | |
| 132 // The view that contains the contents of the "Permissions" section from the | |
| 133 // "Permissions" tab. | |
| 134 views::View* permissions_content_; | |
| 135 | |
| 136 views::Label* identity_info_text_; | |
| 137 views::Label* connection_info_text_; | |
| 138 views::Label* page_info_text_; | |
| 139 | |
| 140 // |ComboboxModel|s are not owned by the |Combobox|. Therefor the popup owns | |
| 141 // all |PermissionComboboxModels| and delets them when it is destroyed. | |
| 142 ScopedVector<website_settings::PermissionComboboxModel> combobox_models_; | |
| 143 | |
| 144 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView); | |
| 145 }; | |
| 146 | |
| 147 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_POPUP_VIEW_H_ | |
| OLD | NEW |