Chromium Code Reviews| Index: components/digital_asset_links/digital_asset_links_handler.h |
| diff --git a/components/digital_asset_links/digital_asset_links_handler.h b/components/digital_asset_links/digital_asset_links_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9249e0de2c114db54dedfb4a5f4d0c15cc4ce73a |
| --- /dev/null |
| +++ b/components/digital_asset_links/digital_asset_links_handler.h |
| @@ -0,0 +1,55 @@ |
| +// 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 COMPONENTS_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_ |
| +#define COMPONENTS_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 { |
| + |
| +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.
|
| + |
| +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.
|
| + public: |
| + virtual void OnRelationshipCheckComplete( |
| + const base::DictionaryValue* response) = 0; |
| + virtual ~AssetLinkListener() {} |
| +}; |
| + |
| +class DigitalAssetLinksHandler : public net::URLFetcherDelegate { |
| + public: |
| + DigitalAssetLinksHandler( |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context); |
| + ~DigitalAssetLinksHandler() override; |
| + |
| + bool CheckDigitalAssetLinkRelationship(AssetLinkListener* listener, |
| + std::string web_domain, |
| + std::string package_name, |
| + std::string fingerprint, |
| + std::string relationship); |
| + |
| + private: |
| + // net::URLFetcherDelegate: |
| + void OnURLFetchComplete(const net::URLFetcher* source) override; |
| + |
| + // URL request context. |
| + scoped_refptr<net::URLRequestContextGetter> request_context_; |
| + |
| + std::unique_ptr<net::URLFetcher> url_fetcher_; |
| + |
| + std::unique_ptr<AssetLinkListener> listener_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DigitalAssetLinksHandler); |
| +}; |
| + |
| +} // namespace digital_asset_links |
| + |
| +#endif // COMPONENTS_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_ |