| 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_WEBSITE_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN, | 58 SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN, |
| 59 // Site identity could not be verified because the site did not provide a | 59 // Site identity could not be verified because the site did not provide a |
| 60 // certificate. This is the expected state for HTTP connections. | 60 // certificate. This is the expected state for HTTP connections. |
| 61 SITE_IDENTITY_STATUS_NO_CERT, | 61 SITE_IDENTITY_STATUS_NO_CERT, |
| 62 // An error occured while verifying the site identity. | 62 // An error occured while verifying the site identity. |
| 63 SITE_IDENTITY_STATUS_ERROR, | 63 SITE_IDENTITY_STATUS_ERROR, |
| 64 // The site is a trusted internal chrome page. | 64 // The site is a trusted internal chrome page. |
| 65 SITE_IDENTITY_STATUS_INTERNAL_PAGE, | 65 SITE_IDENTITY_STATUS_INTERNAL_PAGE, |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // Creates a |WebsiteSettingsModel| incl. a |WebsiteSettingsUI| and displays | |
| 69 // the UI. The |url| contains the omnibox URL of the currently active tab, | |
| 70 // |parent| contains the currently active window, |profile| contains the | |
| 71 // currently active profile and |ssl| contains the |SSLStatus| of the | |
| 72 // connection to the website in the currently active tab that is wrapped by | |
| 73 // the |tab_contents_wrapper|. | |
| 74 static void Show(gfx::NativeWindow parent, | |
| 75 Profile* profile, | |
| 76 TabContentsWrapper* tab_contents_wrapper, | |
| 77 const GURL& url, | |
| 78 const content::SSLStatus& ssl); | |
| 79 | |
| 80 // 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 |
| 81 // object to determine the status of the site's connection. The | 69 // object to determine the status of the site's connection. The |
| 82 // |WebsiteSettings| takes ownership of the |ui|. | 70 // |WebsiteSettings| takes ownership of the |ui|. |
| 83 WebsiteSettings(WebsiteSettingsUI* ui, | 71 WebsiteSettings(WebsiteSettingsUI* ui, |
| 84 Profile* profile, | 72 Profile* profile, |
| 85 TabSpecificContentSettings* tab_specific_content_settings, | 73 TabSpecificContentSettings* tab_specific_content_settings, |
| 86 const GURL& url, | 74 const GURL& url, |
| 87 const content::SSLStatus& ssl, | 75 const content::SSLStatus& ssl, |
| 88 content::CertStore* cert_store); | 76 content::CertStore* cert_store); |
| 89 | 77 virtual ~WebsiteSettings(); |
| 90 // This method is called when the WebsiteSettingsUI is closed. It triggers | |
| 91 // the destruction of this |WebsiteSettings| object. So it is not safe to use | |
| 92 // this object afterwards. Any pointers to this object will be invalid. | |
| 93 void OnUIClosing(); | |
| 94 | 78 |
| 95 // This method is called when ever a permission setting is changed. | 79 // This method is called when ever a permission setting is changed. |
| 96 void OnSitePermissionChanged(ContentSettingsType type, | 80 void OnSitePermissionChanged(ContentSettingsType type, |
| 97 ContentSetting value); | 81 ContentSetting value); |
| 98 | 82 |
| 99 // Callback used for requests to fetch the number of page visits from history | 83 // Callback used for requests to fetch the number of page visits from history |
| 100 // service and the time of the first visit. | 84 // service and the time of the first visit. |
| 101 void OnGotVisitCountToHost(HistoryService::Handle handle, | 85 void OnGotVisitCountToHost(HistoryService::Handle handle, |
| 102 bool found_visits, | 86 bool found_visits, |
| 103 int visit_count, | 87 int visit_count, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 121 } | 105 } |
| 122 | 106 |
| 123 string16 organization_name() const { | 107 string16 organization_name() const { |
| 124 return organization_name_; | 108 return organization_name_; |
| 125 } | 109 } |
| 126 | 110 |
| 127 // SiteDataObserver implementation. | 111 // SiteDataObserver implementation. |
| 128 virtual void OnSiteDataAccessed() OVERRIDE; | 112 virtual void OnSiteDataAccessed() OVERRIDE; |
| 129 | 113 |
| 130 private: | 114 private: |
| 131 virtual ~WebsiteSettings(); | |
| 132 | |
| 133 // Initializes the |WebsiteSettings|. | 115 // Initializes the |WebsiteSettings|. |
| 134 void Init(Profile* profile, | 116 void Init(Profile* profile, |
| 135 const GURL& url, | 117 const GURL& url, |
| 136 const content::SSLStatus& ssl); | 118 const content::SSLStatus& ssl); |
| 137 | 119 |
| 138 // Sets (presents) the information about the site's permissions in the |ui_|. | 120 // Sets (presents) the information about the site's permissions in the |ui_|. |
| 139 void PresentSitePermissions(); | 121 void PresentSitePermissions(); |
| 140 | 122 |
| 141 // Sets (presents) the information about the site's data in the |ui_|. | 123 // Sets (presents) the information about the site's data in the |ui_|. |
| 142 void PresentSiteData(); | 124 void PresentSiteData(); |
| 143 | 125 |
| 144 // Sets (presents) the information about the site's identity and connection | 126 // Sets (presents) the information about the site's identity and connection |
| 145 // in the |ui_|. | 127 // in the |ui_|. |
| 146 void PresentSiteIdentity(); | 128 void PresentSiteIdentity(); |
| 147 | 129 |
| 148 // Sets (presents) history information about the site in the |ui_|. Passing | 130 // Sets (presents) history information about the site in the |ui_|. Passing |
| 149 // base::Time() as value for |first_visit| will clear the history information | 131 // base::Time() as value for |first_visit| will clear the history information |
| 150 // in the UI. | 132 // in the UI. |
| 151 void PresentHistoryInfo(base::Time first_visit); | 133 void PresentHistoryInfo(base::Time first_visit); |
| 152 | 134 |
| 153 // The website settings UI displays information and controls for site | 135 // The website settings UI displays information and controls for site |
| 154 // specific data (local stored objects like cookies), site specific | 136 // specific data (local stored objects like cookies), site specific |
| 155 // permissions (location, popup, plugin, etc. permissions) and site specific | 137 // permissions (location, popup, plugin, etc. permissions) and site specific |
| 156 // information (identity, connection status, etc.). | 138 // information (identity, connection status, etc.). |
| 157 scoped_ptr<WebsiteSettingsUI> ui_; | 139 WebsiteSettingsUI* ui_; |
| 158 | 140 |
| 159 // The Omnibox URL of the website for which to display site permissions and | 141 // The Omnibox URL of the website for which to display site permissions and |
| 160 // site information. | 142 // site information. |
| 161 GURL site_url_; | 143 GURL site_url_; |
| 162 | 144 |
| 163 // Status of the website's identity verification check. | 145 // Status of the website's identity verification check. |
| 164 SiteIdentityStatus site_identity_status_; | 146 SiteIdentityStatus site_identity_status_; |
| 165 | 147 |
| 166 // For secure connection |cert_id_| is set to the ID of the server | 148 // For secure connection |cert_id_| is set to the ID of the server |
| 167 // certificate. For non secure connections |cert_id_| is 0. | 149 // certificate. For non secure connections |cert_id_| is 0. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 197 // The |HostContentSettingsMap| is the service that provides and manages | 179 // The |HostContentSettingsMap| is the service that provides and manages |
| 198 // content settings (aka. site permissions). | 180 // content settings (aka. site permissions). |
| 199 HostContentSettingsMap* content_settings_; | 181 HostContentSettingsMap* content_settings_; |
| 200 | 182 |
| 201 // Used to request the number of page visits. | 183 // Used to request the number of page visits. |
| 202 CancelableRequestConsumer visit_count_request_consumer_; | 184 CancelableRequestConsumer visit_count_request_consumer_; |
| 203 | 185 |
| 204 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); | 186 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); |
| 205 }; | 187 }; |
| 206 | 188 |
| 207 #endif // CHROME_BROWSER_WEBSITE_SETTINGS_H_ | 189 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_H_ |
| OLD | NEW |