blob: f8303909e18203f154176ea8eca40d9518b0c1a5 [file] [log] [blame]
// Copyright 2022 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_SAFE_BROWSING_EXTENSION_TELEMETRY_COOKIES_GET_SIGNAL_H_
#define CHROME_BROWSER_SAFE_BROWSING_EXTENSION_TELEMETRY_COOKIES_GET_SIGNAL_H_
#include "chrome/browser/safe_browsing/extension_telemetry/extension_signal.h"
#include "extensions/common/stack_frame.h"
namespace safe_browsing {
// A signal that is created when an extension invokes cookies.get API.
class CookiesGetSignal : public ExtensionSignal {
public:
CookiesGetSignal(
const extensions::ExtensionId& extension_id,
const std::string& name,
const std::string& store_id,
const std::string& url,
extensions::StackTrace js_callstack = extensions::StackTrace());
~CookiesGetSignal() override;
// ExtensionSignal:
ExtensionSignalType GetType() const override;
// Creates a unique id, which can be used to compare argument sets and as a
// key for storage (e.g., in a map).
std::string getUniqueArgSetId() const;
const std::string& name() const { return name_; }
const std::string& store_id() const { return store_id_; }
const std::string& url() const { return url_; }
const extensions::StackTrace& js_callstack() const { return js_callstack_; }
protected:
// Filters the cookies by name.
std::string name_;
// The cookie store to retrieve cookies from. If omitted, the current
// execution context's cookie store will be used.
std::string store_id_;
// Restricts the retrieved cookies to those that would match the given URL.
std::string url_;
// JS callstack retrieved when the API was invoked.
extensions::StackTrace js_callstack_;
};
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_EXTENSION_TELEMETRY_COOKIES_GET_SIGNAL_H_