OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/browser/cancelable_request.h" | 11 #include "chrome/browser/cancelable_request.h" |
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/common/content_settings.h" | 14 #include "chrome/common/content_settings.h" |
15 #include "chrome/common/content_settings_types.h" | 15 #include "chrome/common/content_settings_types.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class CertStore; | 20 class CertStore; |
21 struct SSLStatus; | 21 struct SSLStatus; |
22 } | 22 } |
23 | 23 |
| 24 class InfoBarTabHelper; |
24 class HostContentSettingsMap; | 25 class HostContentSettingsMap; |
25 class Profile; | 26 class Profile; |
26 class WebsiteSettingsUI; | 27 class WebsiteSettingsUI; |
27 | 28 |
28 // The |WebsiteSettings| provides information about a website's permissions, | 29 // The |WebsiteSettings| provides information about a website's permissions, |
29 // connection state and its identity. It owns a UI that displays the | 30 // connection state and its identity. It owns a UI that displays the |
30 // information and allows users to change the permissions. |WebsiteSettings| | 31 // information and allows users to change the permissions. |WebsiteSettings| |
31 // objects must be created on the heap. They destroy themselves after the UI is | 32 // objects must be created on the heap. They destroy themselves after the UI is |
32 // closed. | 33 // closed. |
33 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { | 34 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { |
(...skipping 29 matching lines...) Expand all Loading... |
63 // The site is a trusted internal chrome page. | 64 // The site is a trusted internal chrome page. |
64 SITE_IDENTITY_STATUS_INTERNAL_PAGE, | 65 SITE_IDENTITY_STATUS_INTERNAL_PAGE, |
65 }; | 66 }; |
66 | 67 |
67 // Creates a WebsiteSettings for the passed |url| using the given |ssl| status | 68 // Creates a WebsiteSettings for the passed |url| using the given |ssl| status |
68 // object to determine the status of the site's connection. The | 69 // object to determine the status of the site's connection. The |
69 // |WebsiteSettings| takes ownership of the |ui|. | 70 // |WebsiteSettings| takes ownership of the |ui|. |
70 WebsiteSettings(WebsiteSettingsUI* ui, | 71 WebsiteSettings(WebsiteSettingsUI* ui, |
71 Profile* profile, | 72 Profile* profile, |
72 TabSpecificContentSettings* tab_specific_content_settings, | 73 TabSpecificContentSettings* tab_specific_content_settings, |
| 74 InfoBarTabHelper* infobar_tab_helper, |
73 const GURL& url, | 75 const GURL& url, |
74 const content::SSLStatus& ssl, | 76 const content::SSLStatus& ssl, |
75 content::CertStore* cert_store); | 77 content::CertStore* cert_store); |
76 virtual ~WebsiteSettings(); | 78 virtual ~WebsiteSettings(); |
77 | 79 |
78 // This method is called when ever a permission setting is changed. | 80 // This method is called when ever a permission setting is changed. |
79 void OnSitePermissionChanged(ContentSettingsType type, | 81 void OnSitePermissionChanged(ContentSettingsType type, |
80 ContentSetting value); | 82 ContentSetting value); |
81 | 83 |
82 // Callback used for requests to fetch the number of page visits from history | 84 // Callback used for requests to fetch the number of page visits from history |
83 // service and the time of the first visit. | 85 // service and the time of the first visit. |
84 void OnGotVisitCountToHost(HistoryService::Handle handle, | 86 void OnGotVisitCountToHost(HistoryService::Handle handle, |
85 bool found_visits, | 87 bool found_visits, |
86 int visit_count, | 88 int visit_count, |
87 base::Time first_visit); | 89 base::Time first_visit); |
88 | 90 |
| 91 // This method is called by the UI when the UI is closing. |
| 92 void OnUIClosing(); |
| 93 |
89 // Accessors. | 94 // Accessors. |
90 SiteConnectionStatus site_connection_status() const { | 95 SiteConnectionStatus site_connection_status() const { |
91 return site_connection_status_; | 96 return site_connection_status_; |
92 } | 97 } |
93 | 98 |
94 SiteIdentityStatus site_identity_status() const { | 99 SiteIdentityStatus site_identity_status() const { |
95 return site_identity_status_; | 100 return site_identity_status_; |
96 } | 101 } |
97 | 102 |
98 string16 site_connection_details() const { | 103 string16 site_connection_details() const { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // base::Time() as value for |first_visit| will clear the history information | 135 // base::Time() as value for |first_visit| will clear the history information |
131 // in the UI. | 136 // in the UI. |
132 void PresentHistoryInfo(base::Time first_visit); | 137 void PresentHistoryInfo(base::Time first_visit); |
133 | 138 |
134 // The website settings UI displays information and controls for site | 139 // The website settings UI displays information and controls for site |
135 // specific data (local stored objects like cookies), site specific | 140 // specific data (local stored objects like cookies), site specific |
136 // permissions (location, popup, plugin, etc. permissions) and site specific | 141 // permissions (location, popup, plugin, etc. permissions) and site specific |
137 // information (identity, connection status, etc.). | 142 // information (identity, connection status, etc.). |
138 WebsiteSettingsUI* ui_; | 143 WebsiteSettingsUI* ui_; |
139 | 144 |
| 145 // The infobar helper of the active tab. |
| 146 InfoBarTabHelper* infobar_helper_; // Owned by the active tab contents. |
| 147 |
| 148 // The flag that controls whether an infobar is displayed after the website |
| 149 // settings UI is closed or not. |
| 150 bool show_info_bar_; |
| 151 |
140 // The Omnibox URL of the website for which to display site permissions and | 152 // The Omnibox URL of the website for which to display site permissions and |
141 // site information. | 153 // site information. |
142 GURL site_url_; | 154 GURL site_url_; |
143 | 155 |
144 // Status of the website's identity verification check. | 156 // Status of the website's identity verification check. |
145 SiteIdentityStatus site_identity_status_; | 157 SiteIdentityStatus site_identity_status_; |
146 | 158 |
147 // For secure connection |cert_id_| is set to the ID of the server | 159 // For secure connection |cert_id_| is set to the ID of the server |
148 // certificate. For non secure connections |cert_id_| is 0. | 160 // certificate. For non secure connections |cert_id_| is 0. |
149 int cert_id_; | 161 int cert_id_; |
(...skipping 29 matching lines...) Expand all Loading... |
179 // content settings (aka. site permissions). | 191 // content settings (aka. site permissions). |
180 HostContentSettingsMap* content_settings_; | 192 HostContentSettingsMap* content_settings_; |
181 | 193 |
182 // Used to request the number of page visits. | 194 // Used to request the number of page visits. |
183 CancelableRequestConsumer visit_count_request_consumer_; | 195 CancelableRequestConsumer visit_count_request_consumer_; |
184 | 196 |
185 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); | 197 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); |
186 }; | 198 }; |
187 | 199 |
188 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ | 200 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ |
OLD | NEW |