Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / website_settings / website_settings_popup_view.h
blobbe74574f5dcfe8fa428219c91e3e9a1147729fb5
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 // Handles LinkClicked asynchronously.
120 void HandleLinkClickedAsync(views::Link* source);
122 // The web contents of the current tab. The popup can't live longer than a
123 // tab.
124 content::WebContents* web_contents_;
126 // The Browser is used to load the help center page.
127 Browser* browser_;
129 // The presenter that controlls the Website Settings UI.
130 scoped_ptr<WebsiteSettings> presenter_;
132 PopupHeaderView* header_; // Owned by views hierarchy.
134 // The |TabbedPane| that contains the tabs of the Website Settings UI.
135 views::TabbedPane* tabbed_pane_;
137 // The view that contains the contents of the "Cookies and Site data" section
138 // from the "Permissions" tab.
139 views::View* site_data_content_;
140 // The link that opend the "Cookies" dialog.
141 views::Link* cookie_dialog_link_;
142 // The view that contains the contents of the "Permissions" section from the
143 // "Permissions" tab.
144 views::View* permissions_content_;
146 // The view that contains the connection tab contents.
147 views::View* connection_tab_;
148 // The view that contains the ui elements for displaying information about
149 // the site's identity.
150 views::View* identity_info_content_;
151 // The link to open the certificate viewer for displaying the certificate
152 // provided by the website. If the site does not provide a certificate then
153 // |certificate_dialog_link_| is NULL.
154 views::Link* certificate_dialog_link_;
156 // The id of the certificate provided by the site. If the site does not
157 // provide a certificate then |cert_id_| is 0.
158 int cert_id_;
159 // The IDs and validation status of Signed Certificate TImestamps provided
160 // by the site. Empty if no SCTs accompany the certificate.
161 content::SignedCertificateTimestampIDStatusList
162 signed_certificate_timestamp_ids_;
164 // The link to open the help center page that contains more information about
165 // the connection status icons.
166 views::Link* help_center_link_;
168 views::View* connection_info_content_;
169 views::View* page_info_content_;
171 base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_;
173 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
176 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_