blob: db62988635a26ea7046c90f10b5f6a1ca4585ffa [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SIGNIN_BOUND_SESSION_CREDENTIALS_BOUND_SESSION_REFRESH_COOKIE_FETCHER_H_
#define CHROME_BROWSER_SIGNIN_BOUND_SESSION_CREDENTIALS_BOUND_SESSION_REFRESH_COOKIE_FETCHER_H_
#include "base/functional/callback_forward.h"
#include "net/base/net_errors.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
// This class makes the network request to the Gaia cookie rotation endpoint to
// refresh bound Google authentication cookies. A new fetcher instance should be
// created per request.
class BoundSessionRefreshCookieFetcher {
public:
struct Result {
net::Error net_error;
absl::optional<int> response_code;
};
// Reports the result of the fetch request.
using RefreshCookieCompleteCallback = base::OnceCallback<void(Result)>;
BoundSessionRefreshCookieFetcher() = default;
virtual ~BoundSessionRefreshCookieFetcher() = default;
BoundSessionRefreshCookieFetcher(const BoundSessionRefreshCookieFetcher&) =
delete;
BoundSessionRefreshCookieFetcher& operator=(
const BoundSessionRefreshCookieFetcher&) = delete;
// Starts the network request to the Gaia rotation endpoint. `callback` is
// called with the fetch results upon completion. Should be called no more
// than once per instance.
virtual void Start(RefreshCookieCompleteCallback callback) = 0;
};
#endif // CHROME_BROWSER_SIGNIN_BOUND_SESSION_CREDENTIALS_BOUND_SESSION_REFRESH_COOKIE_FETCHER_H_