1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_BROWSER_SAFE_BROWSING_DELEGATE_H_
#define EXTENSIONS_BROWSER_SAFE_BROWSING_DELEGATE_H_
#include <string>
#include "extensions/common/api/declarative_net_request.h"
#include "extensions/common/extension_id.h"
class GURL;
namespace content {
class BrowserContext;
class WebContents;
} // namespace content
namespace extensions {
// Provides access to telemetry and safe browsing services for extensions. The
// base class has default implementations for all methods and can act as a stub.
class SafeBrowsingDelegate {
public:
SafeBrowsingDelegate();
SafeBrowsingDelegate(const SafeBrowsingDelegate&) = delete;
SafeBrowsingDelegate& operator=(const SafeBrowsingDelegate&) = delete;
virtual ~SafeBrowsingDelegate();
// Returns true if chrome extension telemetry service is enabled.
virtual bool IsExtensionTelemetryServiceEnabled(
content::BrowserContext* context) const;
// TODO(anunoy): This is a temporary implementation of notifying the
// extension telemetry service of the tabs.executeScript API invocation
// while its usefulness is evaluated.
virtual void NotifyExtensionApiTabExecuteScript(
content::BrowserContext* context,
const ExtensionId& extension_id,
const std::string& code) const {}
// Notifies the extension telemetry service when declarativeNetRequest API
// rules are added.
virtual void NotifyExtensionApiDeclarativeNetRequest(
content::BrowserContext* context,
const ExtensionId& extension_id,
const std::vector<api::declarative_net_request::Rule>& rules) const {}
// Notifies the extension telemetry service when declarativeNetRequest
// redirect action is invoked.
virtual void NotifyExtensionDeclarativeNetRequestRedirectAction(
content::BrowserContext* context,
const ExtensionId& extension_id,
const GURL& request_url,
const GURL& redirect_url) const {}
// Creates password reuse detection manager when new extension web contents
// are created.
virtual void CreatePasswordReuseDetectionManager(
content::WebContents* web_contents) const {}
};
} // namespace extensions
#endif // EXTENSIONS_BROWSER_SAFE_BROWSING_DELEGATE_H_
|