mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
36 lines
870 B
Plaintext
36 lines
870 B
Plaintext
// Copyright 2024 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "crypto/scoped_lacontext.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <LocalAuthentication/LocalAuthentication.h>
|
|
|
|
#include "base/check.h"
|
|
|
|
namespace crypto {
|
|
|
|
struct ScopedLAContext::ObjCStorage {
|
|
LAContext* __strong context;
|
|
};
|
|
|
|
ScopedLAContext::ScopedLAContext(LAContext* lacontext)
|
|
: storage_(std::make_unique<ObjCStorage>()) {
|
|
storage_->context = lacontext;
|
|
}
|
|
|
|
ScopedLAContext::ScopedLAContext(ScopedLAContext&&) = default;
|
|
ScopedLAContext& ScopedLAContext::operator=(ScopedLAContext&& other) = default;
|
|
ScopedLAContext::~ScopedLAContext() = default;
|
|
|
|
LAContext* ScopedLAContext::release() {
|
|
CHECK(storage_);
|
|
LAContext* context = storage_->context;
|
|
storage_.reset();
|
|
return context;
|
|
}
|
|
|
|
} // namespace crypto
|