File: website_settings_popup_view.h

package info (click to toggle)
chromium-browser 41.0.2272.118-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,189,132 kB
  • sloc: cpp: 9,691,462; ansic: 3,341,451; python: 712,689; asm: 518,779; xml: 208,926; java: 169,820; sh: 119,353; perl: 68,907; makefile: 28,311; yacc: 13,305; objc: 11,385; tcl: 3,186; cs: 2,225; sql: 2,217; lex: 2,215; lisp: 1,349; pascal: 1,256; awk: 407; ruby: 155; sed: 53; php: 14; exp: 11
file content (186 lines) | stat: -rw-r--r-- 7,502 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "chrome/browser/ui/views/website_settings/permission_selector_view_observer.h"
#include "chrome/browser/ui/website_settings/website_settings_ui.h"
#include "content/public/common/signed_certificate_timestamp_id_and_status.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h"

class Browser;
class GURL;
class PermissionSelectorView;
class PopupHeaderView;
class Profile;

namespace content {
struct SSLStatus;
class WebContents;
}

namespace views {
class LabelButton;
class Link;
class TabbedPane;
class Widget;
}

// The views implementation of the website settings UI.
class WebsiteSettingsPopupView
    : public PermissionSelectorViewObserver,
      public views::BubbleDelegateView,
      public views::ButtonListener,
      public views::LinkListener,
      public views::TabbedPaneListener,
      public WebsiteSettingsUI {
 public:
  ~WebsiteSettingsPopupView() override;

  static void ShowPopup(views::View* anchor_view,
                        Profile* profile,
                        content::WebContents* web_contents,
                        const GURL& url,
                        const content::SSLStatus& ssl,
                        Browser* browser);

  static bool IsPopupShowing();

 private:
  WebsiteSettingsPopupView(views::View* anchor_view,
                           Profile* profile,
                           content::WebContents* web_contents,
                           const GURL& url,
                           const content::SSLStatus& ssl,
                           Browser* browser);

  // PermissionSelectorViewObserver implementation.
  void OnPermissionChanged(
      const WebsiteSettingsUI::PermissionInfo& permission) override;

  // views::BubbleDelegateView implementation.
  void OnWidgetDestroying(views::Widget* widget) override;

  // views::ButtonListener implementation.
  void ButtonPressed(views::Button* button, const ui::Event& event) override;

  // views::LinkListener implementation.
  void LinkClicked(views::Link* source, int event_flags) override;

  // views::TabbedPaneListener implementations.
  void TabSelectedAt(int index) override;

  // views::View implementation.
  gfx::Size GetPreferredSize() const override;

  // WebsiteSettingsUI implementations.
  void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
  void SetPermissionInfo(
      const PermissionInfoList& permission_info_list) override;
  void SetIdentityInfo(const IdentityInfo& identity_info) override;
  void SetFirstVisit(const base::string16& first_visit) override;
  void SetSelectedTab(TabId tab_id) override;

  // Creates the contents of the "Permissions" tab. The ownership of the
  // returned view is transferred to the caller.
  views::View* CreatePermissionsTab() WARN_UNUSED_RESULT;

  // Creates the contents of the "connection" tab. The ownership of the returned
  // view is transferred to the caller.
  views::View* CreateConnectionTab() WARN_UNUSED_RESULT;

  // Each tab contains several sections with a |headline| followed by the
  // section |contents| and an optional |link|. This method creates a section
  // for the given |headline|, |contents| and |link|. |link| can be NULL if the
  // section should not contain a link.
  views::View* CreateSection(const base::string16& headline,
                             views::View* contents,
                             views::Link* link) WARN_UNUSED_RESULT;

  // Resets the content of a section. All children of the |section_container|
  // are cleared and destroyed first. Then the |icon|, |headline|, |text| and
  // |link| are layout out properly. If the |headline| is an empty string then
  // no headline will be displayed. The ownership of the passed |link| is
  // transfered to the ResetConnectionSection method and the |link| is added to
  // the views hierarchy. If the |link| is NULL then no link is be displayed.
  void ResetConnectionSection(views::View* section_container,
                              const gfx::Image& icon,
                              const base::string16& headline,
                              const base::string16& text,
                              views::Link* link,
                              views::Link* secondary_link,
                              views::LabelButton* reset_decisions_button);

  // The web contents of the current tab. The popup can't live longer than a
  // tab.
  content::WebContents* web_contents_;

  // The Browser is used to load the help center page.
  Browser* browser_;

  // The presenter that controlls the Website Settings UI.
  scoped_ptr<WebsiteSettings> presenter_;

  PopupHeaderView* header_;  // Owned by views hierarchy.

  // The |TabbedPane| that contains the tabs of the Website Settings UI.
  views::TabbedPane* tabbed_pane_;

  // The view that contains the contents of the "Cookies and Site data" section
  // from the "Permissions" tab.
  views::View* site_data_content_;
  // The link that opend the "Cookies" dialog.
  views::Link* cookie_dialog_link_;
  // The view that contains the contents of the "Permissions" section from the
  // "Permissions" tab.
  views::View* permissions_content_;

  // The view that contains the connection tab contents.
  views::View* connection_tab_;
  // The view that contains the ui elements for displaying information about
  // the site's identity.
  views::View* identity_info_content_;
  // The link to open the certificate viewer for displaying the certificate
  // provided by the website. If the site does not provide a certificate then
  // |certificate_dialog_link_| is NULL.
  views::Link* certificate_dialog_link_;
  // The link to open the signed certificate timestamps viewer for displaying
  // Certificate Transparency info. If no such SCTs accompany the certificate
  // then |signed_certificate_timestamps_link_| is NULL.
  views::Link* signed_certificate_timestamps_link_;
  // The button to reset the Allow/Deny certificate errors decision for the
  // current host.
  views::LabelButton* reset_decisions_button_;

  // The id of the certificate provided by the site. If the site does not
  // provide a certificate then |cert_id_| is 0.
  int cert_id_;
  // The IDs and validation status of Signed Certificate TImestamps provided
  // by the site. Empty if no SCTs accompany the certificate.
  content::SignedCertificateTimestampIDStatusList
      signed_certificate_timestamp_ids_;

  // The link to open the help center page that contains more information about
  // the connection status icons.
  views::Link* help_center_link_;

  views::View* connection_info_content_;
  views::View* page_info_content_;

  base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView);
};

#endif  // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_