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

Side by Side Diff: components/digital_asset_links/digital_asset_links_handler.h

Issue 2767333006: Add Digital Asset Links verification for postMessage API (Closed)
Patch Set: moved digital_asset_links to a component 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_
6 #define COMPONENTS_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_
7
8 #include "net/url_request/url_fetcher.h"
9 #include "net/url_request/url_fetcher_delegate.h"
10 #include "net/url_request/url_request_context_getter.h"
11
12 namespace base {
13 class DictionaryValue;
14 }
15
16 namespace digital_asset_links {
17
18 static const char kDigitalAssetLinksCheckResponseKeyLinked[] = "linked";
Benoit L 2017/03/31 15:38:43 nit: Make this constexpr (and hope for the best) o
Yusuf 2017/03/31 22:41:50 Done.
19
20 class AssetLinkListener {
Benoit L 2017/03/31 15:38:43 Since it is a simple Callback for now, what about
Yusuf 2017/03/31 22:41:50 Done.
21 public:
22 virtual void OnRelationshipCheckComplete(
23 const base::DictionaryValue* response) = 0;
24 virtual ~AssetLinkListener() {}
25 };
26
27 class DigitalAssetLinksHandler : public net::URLFetcherDelegate {
28 public:
29 DigitalAssetLinksHandler(
30 const scoped_refptr<net::URLRequestContextGetter>& request_context);
31 ~DigitalAssetLinksHandler() override;
32
33 bool CheckDigitalAssetLinkRelationship(AssetLinkListener* listener,
34 std::string web_domain,
35 std::string package_name,
36 std::string fingerprint,
37 std::string relationship);
38
39 private:
40 // net::URLFetcherDelegate:
41 void OnURLFetchComplete(const net::URLFetcher* source) override;
42
43 // URL request context.
44 scoped_refptr<net::URLRequestContextGetter> request_context_;
45
46 std::unique_ptr<net::URLFetcher> url_fetcher_;
47
48 std::unique_ptr<AssetLinkListener> listener_;
49
50 DISALLOW_COPY_AND_ASSIGN(DigitalAssetLinksHandler);
51 };
52
53 } // namespace digital_asset_links
54
55 #endif // COMPONENTS_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698