Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Unified Diff: components/password_manager/core/browser/site_affiliation/asset_link_data.h

Issue 2967503003: Introduce a parse for digital asset links. (Closed)
Patch Set: Fix compilation Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/site_affiliation/asset_link_data.h
diff --git a/components/password_manager/core/browser/site_affiliation/asset_link_data.h b/components/password_manager/core/browser/site_affiliation/asset_link_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f3766299ed96b68562c239db0bd919e517f8681
--- /dev/null
+++ b/components/password_manager/core/browser/site_affiliation/asset_link_data.h
@@ -0,0 +1,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_

Powered by Google App Engine
This is Rietveld 408576698