summaryrefslogtreecommitdiff
path: root/chromium/components/password_manager/core/browser/site_affiliation/asset_link_data.h
blob: 0f3766299ed96b68562c239db0bd919e517f8681 (plain)
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
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_ASSET_LINK_DATA_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_ASSET_LINK_DATA_H_

#include <string>
#include <vector>

#include "base/macros.h"
#include "url/gurl.h"

namespace password_manager {

// The class parses an asset link file. The spec for the format is
// https://github.com/google/digitalassetlinks/blob/master/well-known/details.md
// The class cares only about two types of statements:
// - includes. Those are just a reference to a file to be loaded and parsed.
// - "get_login_creds" permission to a web page. That means that the target is
//   allowed to get the credentials saved for the source.
// Only HTTPS URLs are taken into account.
class AssetLinkData {
 public:
  AssetLinkData();
  AssetLinkData(AssetLinkData&& other) noexcept;
  ~AssetLinkData();

  AssetLinkData& operator=(AssetLinkData&& other);

  bool Parse(const std::string& data);

  const std::vector<GURL>& includes() const { return includes_; }
  const std::vector<GURL>& targets() const { return targets_; }

 private:
  std::vector<GURL> includes_;
  std::vector<GURL> targets_;

  DISALLOW_COPY_AND_ASSIGN(AssetLinkData);
};

}  // namespace password_manager
#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_ASSET_LINK_DATA_H_