NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / views / website_settings / website_settings_popup_view.h
blob35fefd1d36609d685ea320a30d18fa53ecedb855
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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/ui/views/website_settings/permission_selector_view_observer.h"
14 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h"
16 #include "ui/views/bubble/bubble_delegate.h"
17 #include "ui/views/controls/button/button.h"
18 #include "ui/views/controls/link_listener.h"
19 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h"
21 class Browser;
22 class GURL;
23 class PermissionSelectorView;
24 class PopupHeaderView;
25 class Profile;
27 namespace content {
28 struct SSLStatus;
29 class WebContents;
32 namespace views {
33 class Link;
34 class TabbedPane;
35 class Widget;
38 // The views implementation of the website settings UI.
39 class WebsiteSettingsPopupView
40 : public PermissionSelectorViewObserver,
41 public views::BubbleDelegateView,
42 public views::ButtonListener,
43 public views::LinkListener,
44 public views::TabbedPaneListener,
45 public WebsiteSettingsUI {
46 public:
47 virtual ~WebsiteSettingsPopupView();
49 static void ShowPopup(views::View* anchor_view,
50 Profile* profile,
51 content::WebContents* web_contents,
52 const GURL& url,
53 const content::SSLStatus& ssl,
54 Browser* browser);
56 private:
57 WebsiteSettingsPopupView(views::View* anchor_view,
58 Profile* profile,
59 content::WebContents* web_contents,
60 const GURL& url,
61 const content::SSLStatus& ssl,
62 Browser* browser);
64 // PermissionSelectorViewObserver implementation.
65 virtual void OnPermissionChanged(
66 PermissionSelectorView* selector) OVERRIDE;
68 // views::BubbleDelegate implementation.
69 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
71 // views::ButtonListener implementation.
72 virtual void ButtonPressed(views::Button* button,
73 const ui::Event& event) OVERRIDE;
75 // views::LinkListener implementation.
76 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
78 // views::TabbedPaneListener implementations.
79 virtual void TabSelectedAt(int index) OVERRIDE;
81 // views::View implementation.
82 virtual gfx::Size GetPreferredSize() OVERRIDE;
84 // WebsiteSettingsUI implementations.
85 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE;
86 virtual void SetPermissionInfo(
87 const PermissionInfoList& permission_info_list) OVERRIDE;
88 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE;
89 virtual void SetFirstVisit(const base::string16& first_visit) OVERRIDE;
90 virtual void SetSelectedTab(TabId tab_id) OVERRIDE;
92 // Creates the contents of the "Permissions" tab. The ownership of the
93 // returned view is transferred to the caller.
94 views::View* CreatePermissionsTab() WARN_UNUSED_RESULT;
96 // Creates the contents of the "connection" tab. The ownership of the returned
97 // view is transferred to the caller.
98 views::View* CreateConnectionTab() WARN_UNUSED_RESULT;
100 // Each tab contains several sections with a |headline| followed by the
101 // section |contents| and an optional |link|. This method creates a section
102 // for the given |headline|, |contents| and |link|. |link| can be NULL if the
103 // section should not contain a link.
104 views::View* CreateSection(const base::string16& headline,
105 views::View* contents,
106 views::Link* link) WARN_UNUSED_RESULT;
108 // Resets the content of a section. All children of the |section_container|
109 // are cleared and destroyed first. Then the |icon|, |headline|, |text| and
110 // |link| are layout out properly. If the |headline| is an empty string then
111 // no headline will be displayed. The ownership of the passed |link| is
112 // transfered to the ResetConnectionSection method and the |link| is added to
113 // the views hierarchy. If the |link| is NULL then no link is be displayed.
114 void ResetConnectionSection(views::View* section_container,
115 const gfx::Image& icon,
116 const base::string16& headline,
117 const base::string16& text,
118 views::Link* link,
119 views::Link* secondary_link);
120 // Handles LinkClicked asynchronously.
121 void HandleLinkClickedAsync(views::Link* source);
123 // The web contents of the current tab. The popup can't live longer than a
124 // tab.
125 content::WebContents* web_contents_;
127 // The Browser is used to load the help center page.
128 Browser* browser_;
130 // The presenter that controlls the Website Settings UI.
131 scoped_ptr<WebsiteSettings> presenter_;
133 PopupHeaderView* header_; // Owned by views hierarchy.
135 // The |TabbedPane| that contains the tabs of the Website Settings UI.
136 views::TabbedPane* tabbed_pane_;
138 // The view that contains the contents of the "Cookies and Site data" section
139 // from the "Permissions" tab.
140 views::View* site_data_content_;
141 // The link that opend the "Cookies" dialog.
142 views::Link* cookie_dialog_link_;
143 // The view that contains the contents of the "Permissions" section from the
144 // "Permissions" tab.
145 views::View* permissions_content_;
147 // The view that contains the connection tab contents.
148 views::View* connection_tab_;
149 // The view that contains the ui elements for displaying information about
150 // the site's identity.
151 views::View* identity_info_content_;
152 // The link to open the certificate viewer for displaying the certificate
153 // provided by the website. If the site does not provide a certificate then
154 // |certificate_dialog_link_| is NULL.
155 views::Link* certificate_dialog_link_;
156 // The link to open the signed certificate timestamps viewer for displaying
157 // Certificate Transparency info. If no such SCTs accompany the certificate
158 // then |signed_certificate_timestamps_link_| is NULL.
159 views::Link* signed_certificate_timestamps_link_;
161 // The id of the certificate provided by the site. If the site does not
162 // provide a certificate then |cert_id_| is 0.
163 int cert_id_;
164 // The IDs and validation status of Signed Certificate TImestamps provided
165 // by the site. Empty if no SCTs accompany the certificate.
166 content::SignedCertificateTimestampIDStatusList
167 signed_certificate_timestamp_ids_;
169 // The link to open the help center page that contains more information about
170 // the connection status icons.
171 views::Link* help_center_link_;
173 views::View* connection_info_content_;
174 views::View* page_info_content_;
176 base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_;
178 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
181 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_