Revert "Only store leading 13 bits of password hash."
[chromium-blink-merge.git] / chrome / browser / ui / views / website_settings / website_settings_popup_view.h
blob7e2a07aaece0132882c1cdd1f3364fb8c32e11df
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/button/label_button.h"
19 #include "ui/views/controls/link_listener.h"
20 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h"
22 class Browser;
23 class GURL;
24 class PermissionSelectorView;
25 class PopupHeaderView;
26 class Profile;
28 namespace content {
29 struct SSLStatus;
30 class WebContents;
33 namespace views {
34 class LabelButton;
35 class Link;
36 class TabbedPane;
37 class Widget;
40 // The views implementation of the website settings UI.
41 class WebsiteSettingsPopupView
42 : public PermissionSelectorViewObserver,
43 public views::BubbleDelegateView,
44 public views::ButtonListener,
45 public views::LinkListener,
46 public views::TabbedPaneListener,
47 public WebsiteSettingsUI {
48 public:
49 ~WebsiteSettingsPopupView() override;
51 static void ShowPopup(views::View* anchor_view,
52 Profile* profile,
53 content::WebContents* web_contents,
54 const GURL& url,
55 const content::SSLStatus& ssl,
56 Browser* browser);
58 static bool IsPopupShowing();
60 private:
61 WebsiteSettingsPopupView(views::View* anchor_view,
62 Profile* profile,
63 content::WebContents* web_contents,
64 const GURL& url,
65 const content::SSLStatus& ssl,
66 Browser* browser);
68 // PermissionSelectorViewObserver implementation.
69 void OnPermissionChanged(
70 const WebsiteSettingsUI::PermissionInfo& permission) override;
72 // views::BubbleDelegateView implementation.
73 void OnWidgetDestroying(views::Widget* widget) override;
75 // views::ButtonListener implementation.
76 void ButtonPressed(views::Button* button, const ui::Event& event) override;
78 // views::LinkListener implementation.
79 void LinkClicked(views::Link* source, int event_flags) override;
81 // views::TabbedPaneListener implementations.
82 void TabSelectedAt(int index) override;
84 // views::View implementation.
85 gfx::Size GetPreferredSize() const override;
87 // WebsiteSettingsUI implementations.
88 void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
89 void SetPermissionInfo(
90 const PermissionInfoList& permission_info_list) override;
91 void SetIdentityInfo(const IdentityInfo& identity_info) override;
92 void SetFirstVisit(const base::string16& first_visit) override;
93 void SetSelectedTab(TabId tab_id) override;
95 // Creates the contents of the "Permissions" tab. The ownership of the
96 // returned view is transferred to the caller.
97 views::View* CreatePermissionsTab() WARN_UNUSED_RESULT;
99 // Creates the contents of the "connection" tab. The ownership of the returned
100 // view is transferred to the caller.
101 views::View* CreateConnectionTab() WARN_UNUSED_RESULT;
103 // Each tab contains several sections with a |headline| followed by the
104 // section |contents| and an optional |link|. This method creates a section
105 // for the given |headline|, |contents| and |link|. |link| can be NULL if the
106 // section should not contain a link.
107 views::View* CreateSection(const base::string16& headline,
108 views::View* contents,
109 views::Link* link) WARN_UNUSED_RESULT;
111 // Resets the content of a section. All children of the |section_container|
112 // are cleared and destroyed first. Then the |icon|, |headline|, |text| and
113 // |link| are layout out properly. If the |headline| is an empty string then
114 // no headline will be displayed. The ownership of the passed |link| is
115 // transfered to the ResetConnectionSection method and the |link| is added to
116 // the views hierarchy. If the |link| is NULL then no link is be displayed.
117 void ResetConnectionSection(views::View* section_container,
118 const gfx::Image& icon,
119 const base::string16& headline,
120 const base::string16& text,
121 views::Link* link,
122 views::Link* secondary_link,
123 views::LabelButton* reset_decisions_button);
125 // The web contents of the current tab. The popup can't live longer than a
126 // tab.
127 content::WebContents* web_contents_;
129 // The Browser is used to load the help center page.
130 Browser* browser_;
132 // The presenter that controlls the Website Settings UI.
133 scoped_ptr<WebsiteSettings> presenter_;
135 PopupHeaderView* header_; // Owned by views hierarchy.
137 // The |TabbedPane| that contains the tabs of the Website Settings UI.
138 views::TabbedPane* tabbed_pane_;
140 // The view that contains the contents of the "Cookies and Site data" section
141 // from the "Permissions" tab.
142 views::View* site_data_content_;
143 // The link that opend the "Cookies" dialog.
144 views::Link* cookie_dialog_link_;
145 // The view that contains the contents of the "Permissions" section from the
146 // "Permissions" tab.
147 views::View* permissions_content_;
149 // The view that contains the connection tab contents.
150 views::View* connection_tab_;
151 // The view that contains the ui elements for displaying information about
152 // the site's identity.
153 views::View* identity_info_content_;
154 // The link to open the certificate viewer for displaying the certificate
155 // provided by the website. If the site does not provide a certificate then
156 // |certificate_dialog_link_| is NULL.
157 views::Link* certificate_dialog_link_;
158 // The link to open the signed certificate timestamps viewer for displaying
159 // Certificate Transparency info. If no such SCTs accompany the certificate
160 // then |signed_certificate_timestamps_link_| is NULL.
161 views::Link* signed_certificate_timestamps_link_;
162 // The button to reset the Allow/Deny certificate errors decision for the
163 // current host.
164 views::LabelButton* reset_decisions_button_;
166 // The id of the certificate provided by the site. If the site does not
167 // provide a certificate then |cert_id_| is 0.
168 int cert_id_;
169 // The IDs and validation status of Signed Certificate TImestamps provided
170 // by the site. Empty if no SCTs accompany the certificate.
171 content::SignedCertificateTimestampIDStatusList
172 signed_certificate_timestamp_ids_;
174 // The link to open the help center page that contains more information about
175 // the connection status icons.
176 views::Link* help_center_link_;
178 views::View* connection_info_content_;
179 views::View* page_info_content_;
181 base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_;
183 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
186 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_