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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 87 // After initialization the status about the site's connection |
88 // and it's identity must be available. | 88 // and it's identity must be available. |
89 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); | 89 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
90 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); | 90 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
wtc
2012/04/23 22:01:23
I think lines 87-90 should be moved to the new
Pre
markusheintz_
2012/04/24 08:49:41
Done.
I saw these as a kind of post condition ch
wtc
2012/04/24 17:14:25
Ah, I see. I didn't notice that. I think you're
| |
91 | 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 | |
110 PresentSitePermissions(); | 92 PresentSitePermissions(); |
111 PresentSiteData(); | 93 PresentSiteData(); |
94 PresentSiteIdentity(); | |
112 } | 95 } |
113 | 96 |
114 WebsiteSettings::~WebsiteSettings() { | 97 WebsiteSettings::~WebsiteSettings() { |
115 } | 98 } |
116 | 99 |
117 void WebsiteSettings::OnUIClosing() { | 100 void WebsiteSettings::OnUIClosing() { |
118 ui_->SetPresenter(NULL); | 101 ui_->SetPresenter(NULL); |
119 delete this; | 102 delete this; |
120 } | 103 } |
121 | 104 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 cookie_info.cookie_source = site_url_.host(); | 421 cookie_info.cookie_source = site_url_.host(); |
439 cookie_info.allowed = GetLocalStoredObjectCount( | 422 cookie_info.allowed = GetLocalStoredObjectCount( |
440 tab_specific_content_settings()->allowed_local_shared_objects()); | 423 tab_specific_content_settings()->allowed_local_shared_objects()); |
441 cookie_info.blocked = GetLocalStoredObjectCount( | 424 cookie_info.blocked = GetLocalStoredObjectCount( |
442 tab_specific_content_settings()->blocked_local_shared_objects()); | 425 tab_specific_content_settings()->blocked_local_shared_objects()); |
443 cookie_info_list.push_back(cookie_info); | 426 cookie_info_list.push_back(cookie_info); |
444 | 427 |
445 ui_->SetCookieInfo(cookie_info_list); | 428 ui_->SetCookieInfo(cookie_info_list); |
446 } | 429 } |
447 | 430 |
431 void WebsiteSettings::PresentSiteIdentity() { | |
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 |