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

Unified Diff: chrome/browser/android/digital_asset_links/digital_asset_links_handler.h

Issue 2767333006: Add Digital Asset Links verification for postMessage API (Closed)
Patch Set: added native unit tests Created 3 years, 8 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: chrome/browser/android/digital_asset_links/digital_asset_links_handler.h
diff --git a/chrome/browser/android/digital_asset_links/digital_asset_links_handler.h b/chrome/browser/android/digital_asset_links/digital_asset_links_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..b78d12ecb934da68f7225faafb8987d3bd9662c9
--- /dev/null
+++ b/chrome/browser/android/digital_asset_links/digital_asset_links_handler.h
@@ -0,0 +1,52 @@
+// Copyright (c) 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 CHROME_BROWSER_ANDROID_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_
+#define CHROME_BROWSER_ANDROID_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_
+
+#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_fetcher_delegate.h"
+#include "net/url_request/url_request_context_getter.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace digital_asset_links {
+
+extern const char kDigitalAssetLinksCheckResponseKeyLinked[];
+
+typedef base::Callback<void(std::unique_ptr<base::DictionaryValue>)>
+ RelationshipCheckResultCallback;
+
+class DigitalAssetLinksHandler : public net::URLFetcherDelegate {
+ public:
+ DigitalAssetLinksHandler(
+ const scoped_refptr<net::URLRequestContextGetter>& request_context);
+ ~DigitalAssetLinksHandler() override;
+
+ bool CheckDigitalAssetLinkRelationship(
+ RelationshipCheckResultCallback listener,
+ const std::string& web_domain,
+ const std::string& package_name,
+ const std::string& fingerprint,
+ const std::string& relationship);
+
+ private:
+ // net::URLFetcherDelegate:
+ void OnURLFetchComplete(const net::URLFetcher* source) override;
+
+ scoped_refptr<net::URLRequestContextGetter> request_context_;
+
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
+
+ // The callback for receiving a URLFetcher result.
+ RelationshipCheckResultCallback callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DigitalAssetLinksHandler);
+};
+
+} // namespace digital_asset_links
+
+#endif // CHROME_BROWSER_ANDROID_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698