Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: chrome/browser/ui/webui/settings/certificates_handler.cc

Issue 1988463002: MD Settings: Convert C++ handlers to be JavaScript-lifecycle aware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/certificates_handler.h" 5 #include "chrome/browser/ui/webui/settings/certificates_handler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 ShowCertificateViewer(web_ui()->GetWebContents(), GetParentWindow(), cert); 479 ShowCertificateViewer(web_ui()->GetWebContents(), GetParentWindow(), cert);
480 } 480 }
481 481
482 void CertificatesHandler::AssignWebUICallbackId(const base::ListValue* args) { 482 void CertificatesHandler::AssignWebUICallbackId(const base::ListValue* args) {
483 CHECK_LE(1U, args->GetSize()); 483 CHECK_LE(1U, args->GetSize());
484 CHECK(webui_callback_id_.empty()); 484 CHECK(webui_callback_id_.empty());
485 CHECK(args->GetString(0, &webui_callback_id_)); 485 CHECK(args->GetString(0, &webui_callback_id_));
486 } 486 }
487 487
488 void CertificatesHandler::HandleGetCATrust(const base::ListValue* args) { 488 void CertificatesHandler::HandleGetCATrust(const base::ListValue* args) {
489 AllowJavascript();
490
489 CHECK_EQ(2U, args->GetSize()); 491 CHECK_EQ(2U, args->GetSize());
490 AssignWebUICallbackId(args); 492 AssignWebUICallbackId(args);
491 std::string node_id; 493 std::string node_id;
492 CHECK(args->GetString(1, &node_id)); 494 CHECK(args->GetString(1, &node_id));
493 495
494 net::X509Certificate* cert = cert_id_map_->IdToCert(node_id); 496 net::X509Certificate* cert = cert_id_map_->IdToCert(node_id);
495 CHECK(cert); 497 CHECK(cert);
496 498
497 net::NSSCertDatabase::TrustBits trust_bits = 499 net::NSSCertDatabase::TrustBits trust_bits =
498 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT); 500 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT);
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 error_info->Set(kCertificateErrors, 1137 error_info->Set(kCertificateErrors,
1136 base::WrapUnique(cert_error_list.release())); 1138 base::WrapUnique(cert_error_list.release()));
1137 RejectCallback(*error_info); 1139 RejectCallback(*error_info);
1138 } 1140 }
1139 1141
1140 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { 1142 gfx::NativeWindow CertificatesHandler::GetParentWindow() const {
1141 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1143 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1142 } 1144 }
1143 1145
1144 } // namespace settings 1146 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/certificates_handler.h ('k') | chrome/browser/ui/webui/settings/downloads_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698