OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/certificate_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" |
6 | 6 |
7 #include "base/file_util.h" // for FileAccessProvider | 7 #include "base/file_util.h" // for FileAccessProvider |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/safe_strerror_posix.h" | 9 #include "base/safe_strerror_posix.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 | 459 |
460 void CertificateManagerHandler::GetCATrust(const ListValue* args) { | 460 void CertificateManagerHandler::GetCATrust(const ListValue* args) { |
461 net::X509Certificate* cert = CallbackArgsToCert(args); | 461 net::X509Certificate* cert = CallbackArgsToCert(args); |
462 if (!cert) { | 462 if (!cert) { |
463 web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); | 463 web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.dismiss"); |
464 return; | 464 return; |
465 } | 465 } |
466 | 466 |
467 int trust = certificate_manager_model_->cert_db().GetCertTrust( | 467 int trust = certificate_manager_model_->cert_db().GetCertTrust( |
468 cert, net::CA_CERT); | 468 cert, net::CA_CERT); |
469 using base::FundamentalValue; | 469 base::FundamentalValue ssl_value(!!(trust & net::CertDatabase::TRUSTED_SSL)); |
Nico
2011/08/19 20:34:23
(I remember seeing !! for the first time in some o
| |
470 FundamentalValue ssl_value(bool(trust & net::CertDatabase::TRUSTED_SSL)); | 470 base::FundamentalValue email_value( |
471 FundamentalValue email_value(bool(trust & net::CertDatabase::TRUSTED_EMAIL)); | 471 !!(trust & net::CertDatabase::TRUSTED_EMAIL)); |
472 FundamentalValue obj_sign_value( | 472 base::FundamentalValue obj_sign_value( |
473 bool(trust & net::CertDatabase::TRUSTED_OBJ_SIGN)); | 473 !!(trust & net::CertDatabase::TRUSTED_OBJ_SIGN)); |
474 web_ui_->CallJavascriptFunction( | 474 web_ui_->CallJavascriptFunction("CertificateEditCaTrustOverlay.populateTrust", |
475 "CertificateEditCaTrustOverlay.populateTrust", | |
476 ssl_value, email_value, obj_sign_value); | 475 ssl_value, email_value, obj_sign_value); |
477 } | 476 } |
478 | 477 |
479 void CertificateManagerHandler::EditCATrust(const ListValue* args) { | 478 void CertificateManagerHandler::EditCATrust(const ListValue* args) { |
480 net::X509Certificate* cert = CallbackArgsToCert(args); | 479 net::X509Certificate* cert = CallbackArgsToCert(args); |
481 bool fail = !cert; | 480 bool fail = !cert; |
482 bool trust_ssl = false; | 481 bool trust_ssl = false; |
483 bool trust_email = false; | 482 bool trust_email = false; |
484 bool trust_obj_sign = false; | 483 bool trust_obj_sign = false; |
485 fail |= !CallbackArgsToBool(args, 1, &trust_ssl); | 484 fail |= !CallbackArgsToBool(args, 1, &trust_ssl); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 // TODO(xiyuan): Use async way when underlying supports it. | 995 // TODO(xiyuan): Use async way when underlying supports it. |
997 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); | 996 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); |
998 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 997 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
999 ready); | 998 ready); |
1000 } | 999 } |
1001 #endif | 1000 #endif |
1002 | 1001 |
1003 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1002 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1004 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); | 1003 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); |
1005 } | 1004 } |
OLD | NEW |