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 #include "chrome/browser/website_settings.h" | 5 #include "chrome/browser/website_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 : TabSpecificContentSettings::SiteDataObserver( | 77 : TabSpecificContentSettings::SiteDataObserver( |
78 tab_specific_content_settings), | 78 tab_specific_content_settings), |
79 ui_(ui), | 79 ui_(ui), |
80 site_url_(url), | 80 site_url_(url), |
81 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), | 81 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
82 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), | 82 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
83 cert_store_(cert_store), | 83 cert_store_(cert_store), |
84 content_settings_(profile->GetHostContentSettingsMap()) { | 84 content_settings_(profile->GetHostContentSettingsMap()) { |
85 ui_->SetPresenter(this); | 85 ui_->SetPresenter(this); |
86 Init(profile, url, ssl); | 86 Init(profile, url, ssl); |
87 // After initialization the status about the site's connection | |
88 // and it's identity must be available. | |
89 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); | |
90 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); | |
91 | |
92 // TODO(markusheintz): Add the strings below to the grd file once a decision | |
93 // has been made about the exact wording. | |
94 std::string site_info; | |
95 switch (site_identity_status_) { | |
96 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: | |
97 case WebsiteSettings::SITE_IDENTITY_STATUS_DNSSEC_CERT: | |
98 site_info = "Identity verified"; | |
99 break; | |
100 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: | |
101 site_info = UTF16ToUTF8(organization_name()); | |
102 site_info += " - Identity verified"; | |
103 break; | |
104 default: | |
105 site_info = "Identity not verified"; | |
106 break; | |
107 } | |
108 ui_->SetSiteInfo(site_info); | |
109 | 87 |
110 PresentSitePermissions(); | 88 PresentSitePermissions(); |
111 PresentSiteData(); | 89 PresentSiteData(); |
| 90 PresentSiteIdentity(); |
112 } | 91 } |
113 | 92 |
114 WebsiteSettings::~WebsiteSettings() { | 93 WebsiteSettings::~WebsiteSettings() { |
115 } | 94 } |
116 | 95 |
117 void WebsiteSettings::OnUIClosing() { | 96 void WebsiteSettings::OnUIClosing() { |
118 ui_->SetPresenter(NULL); | 97 ui_->SetPresenter(NULL); |
119 delete this; | 98 delete this; |
120 } | 99 } |
121 | 100 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 cookie_info.cookie_source = site_url_.host(); | 417 cookie_info.cookie_source = site_url_.host(); |
439 cookie_info.allowed = GetLocalStoredObjectCount( | 418 cookie_info.allowed = GetLocalStoredObjectCount( |
440 tab_specific_content_settings()->allowed_local_shared_objects()); | 419 tab_specific_content_settings()->allowed_local_shared_objects()); |
441 cookie_info.blocked = GetLocalStoredObjectCount( | 420 cookie_info.blocked = GetLocalStoredObjectCount( |
442 tab_specific_content_settings()->blocked_local_shared_objects()); | 421 tab_specific_content_settings()->blocked_local_shared_objects()); |
443 cookie_info_list.push_back(cookie_info); | 422 cookie_info_list.push_back(cookie_info); |
444 | 423 |
445 ui_->SetCookieInfo(cookie_info_list); | 424 ui_->SetCookieInfo(cookie_info_list); |
446 } | 425 } |
447 | 426 |
| 427 void WebsiteSettings::PresentSiteIdentity() { |
| 428 // After initialization the status about the site's connection |
| 429 // and it's identity must be available. |
| 430 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
| 431 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
| 432 WebsiteSettingsUI::IdentityInfo info; |
| 433 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) |
| 434 info.site_identity = UTF16ToUTF8(organization_name()); |
| 435 else |
| 436 info.site_identity = site_url_.host(); |
| 437 |
| 438 info.connection_status = site_connection_status_; |
| 439 info.connection_status_description = |
| 440 UTF16ToUTF8(site_connection_details_); |
| 441 info.identity_status = site_identity_status_; |
| 442 info.identity_status_description = |
| 443 UTF16ToUTF8(site_identity_details_); |
| 444 ui_->SetIdentityInfo(info); |
| 445 } |
| 446 |
448 // static | 447 // static |
449 void WebsiteSettings::Show(gfx::NativeWindow parent, | 448 void WebsiteSettings::Show(gfx::NativeWindow parent, |
450 Profile* profile, | 449 Profile* profile, |
451 TabContentsWrapper* tab_contents_wrapper, | 450 TabContentsWrapper* tab_contents_wrapper, |
452 const GURL& url, | 451 const GURL& url, |
453 const content::SSLStatus& ssl) { | 452 const content::SSLStatus& ssl) { |
454 #if defined(TOOLKIT_GTK) | 453 #if defined(TOOLKIT_GTK) |
455 // The WebsiteSettingsModel will delete itself after the UI is closed. | 454 // The WebsiteSettingsModel will delete itself after the UI is closed. |
456 new WebsiteSettings(new WebsiteSettingsPopupGtk(parent, | 455 new WebsiteSettings(new WebsiteSettingsPopupGtk(parent, |
457 profile, | 456 profile, |
458 tab_contents_wrapper), | 457 tab_contents_wrapper), |
459 profile, | 458 profile, |
460 tab_contents_wrapper->content_settings(), | 459 tab_contents_wrapper->content_settings(), |
461 url, | 460 url, |
462 ssl, | 461 ssl, |
463 content::CertStore::GetInstance()); | 462 content::CertStore::GetInstance()); |
464 #endif | 463 #endif |
465 } | 464 } |
OLD | NEW |