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