Chromium Code Reviews| 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..3129480e1337b14276983acae405392cc028d8f6 |
| --- /dev/null |
| +++ b/chrome/browser/android/digital_asset_links/digital_asset_links_handler.h |
| @@ -0,0 +1,53 @@ |
| +// 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( |
| + std::unique_ptr<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; |
| + |
| + // URL request context. |
| + scoped_refptr<net::URLRequestContextGetter> request_context_; |
| + |
| + std::unique_ptr<net::URLFetcher> url_fetcher_; |
| + |
| + // The callback for receiving a URLFether result. This handler owns this. |
|
Benoit L
2017/04/04 18:44:12
nit: ownership is implied by the unique_ptr.
Yusuf
2017/04/05 00:20:42
Done.
|
| + std::unique_ptr<RelationshipCheckResultCallback> callback_; |
|
Benoit L
2017/04/04 18:44:12
And actually, since this is a callback, why not ta
Yusuf
2017/04/05 00:20:42
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DigitalAssetLinksHandler); |
| +}; |
| + |
| +} // namespace digital_asset_links |
| + |
| +#endif // CHROME_BROWSER_ANDROID_DIGITAL_ASSET_LINKS_DIGITAL_ASSET_LINKS_HANDLER_H_ |