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

content / public / browser / permission_request_description.cc [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.

#include "content/public/browser/permission_request_description.h"

namespace content {

PermissionRequestDescription::PermissionRequestDescription(
    const std::vector<blink::PermissionType>& permissions,
    bool user_gesture,
    const GURL& requesting_origin,
    bool embedded_permission_element_initiated,
    const std::optional<gfx::Rect>& anchor_element_position)
    : permissions(permissions),
      user_gesture(user_gesture),
      requesting_origin(requesting_origin),
      embedded_permission_element_initiated(
          embedded_permission_element_initiated),
      anchor_element_position(anchor_element_position) {}

PermissionRequestDescription::PermissionRequestDescription(
    blink::PermissionType permission,
    bool user_gesture,
    const GURL& requesting_origin,
    bool embedded_permission_element_initiated,
    const std::optional<gfx::Rect>& anchor_element_position)
    : PermissionRequestDescription(
          std::vector<blink::PermissionType>{permission},
          user_gesture,
          requesting_origin,
          embedded_permission_element_initiated,
          anchor_element_position) {}

PermissionRequestDescription::PermissionRequestDescription(
    const PermissionRequestDescription&) = default;
PermissionRequestDescription& PermissionRequestDescription::operator=(
    PermissionRequestDescription&&) = default;
PermissionRequestDescription::PermissionRequestDescription(
    PermissionRequestDescription&&) = default;
PermissionRequestDescription::~PermissionRequestDescription() = default;

bool PermissionRequestDescription::operator==(
    const PermissionRequestDescription& other) const {
  return user_gesture == other.user_gesture &&
         embedded_permission_element_initiated ==
             other.embedded_permission_element_initiated &&
         requesting_origin == other.requesting_origin &&
         permissions == other.permissions &&
         anchor_element_position == other.anchor_element_position;
}

}  // namespace content