Chromium Code Reviews| Index: chrome/browser/android/offline_pages/offline_page_request_handler.h |
| diff --git a/chrome/browser/android/offline_pages/offline_page_request_handler.h b/chrome/browser/android/offline_pages/offline_page_request_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8018d13c052b4614c64082d70be5091a7c917b0a |
| --- /dev/null |
| +++ b/chrome/browser/android/offline_pages/offline_page_request_handler.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 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_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_HANDLER_H_ |
| +#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_HANDLER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/supports_user_data.h" |
| +#include "content/public/common/resource_type.h" |
| + |
| +namespace net { |
| +class NetworkDelegate; |
| +class URLRequest; |
| +class URLRequestInterceptor; |
| +class URLRequestJob; |
| +} |
| + |
| +namespace offline_pages { |
| + |
| +// Class for servicing requests based on their offline information. Created one |
| +// per URLRequest and attached to each request. |
|
fgorski
2016/08/10 16:26:10
Please add a little longer comment that explains t
jianli
2016/08/10 21:37:25
Done.
|
| +class OfflinePageRequestHandler : public base::SupportsUserData::Data { |
| + public: |
| + // Attaches a newly created handler if the given |request| needs to |
|
fgorski
2016/08/10 16:26:10
is there something missing in this sentence?
If ye
jianli
2016/08/10 21:37:25
Done.
|
| + static void InitializeHandler(net::URLRequest* request, |
| + content::ResourceType resource_type); |
| + |
| + // Returns the handler attached to |request|. This may return null if no |
| + // handler is attached. |
| + static OfflinePageRequestHandler* GetHandler(net::URLRequest* request); |
| + |
| + // Creates a protocol interceptor for offline pages. |
| + static std::unique_ptr<net::URLRequestInterceptor> CreateInterceptor( |
| + void* profile_id); |
|
fgorski
2016/08/10 16:26:10
please document profile_id and explain why it is v
jianli
2016/08/10 21:37:25
Done.
|
| + |
| + ~OfflinePageRequestHandler() override; |
| + |
| + net::URLRequestJob* MaybeCreateJob( |
| + net::URLRequest* request, |
| + net::NetworkDelegate* network_delegate, |
| + void* profile_id); |
| + |
| + private: |
| + OfflinePageRequestHandler(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestHandler); |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_HANDLER_H_ |