| Index: components/offline_pages/loaded_offline_page_info.h
|
| diff --git a/components/offline_pages/loaded_offline_page_info.h b/components/offline_pages/loaded_offline_page_info.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1eb8df40779127f65360b5a70d64d15eea9ae595
|
| --- /dev/null
|
| +++ b/components/offline_pages/loaded_offline_page_info.h
|
| @@ -0,0 +1,62 @@
|
| +// 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 COMPONENTS_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
|
| +#define COMPONENTS_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
|
| +
|
| +#include <memory>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/supports_user_data.h"
|
| +
|
| +namespace net {
|
| +class URLRequest;
|
| +}
|
| +
|
| +namespace offline_pages {
|
| +
|
| +struct OfflinePageItem;
|
| +struct OfflinePageHeader;
|
| +
|
| +// Contains the info about the offline page being loaded.
|
| +class LoadedOfflinePageInfo : public base::SupportsUserData::Data {
|
| + public:
|
| + LoadedOfflinePageInfo();
|
| + ~LoadedOfflinePageInfo() override;
|
| +
|
| + std::unique_ptr<LoadedOfflinePageInfo> DeepCopy();
|
| +
|
| + // static
|
| + static void CreateInfoForRequest(
|
| + net::URLRequest* request,
|
| + std::unique_ptr<OfflinePageItem> offline_page,
|
| + std::unique_ptr<OfflinePageHeader> offline_header,
|
| + bool is_offline_preview);
|
| +
|
| + // static
|
| + static LoadedOfflinePageInfo* GetInfo(const net::URLRequest& request);
|
| +
|
| + OfflinePageItem* offline_page() { return offline_page_.get(); }
|
| +
|
| + OfflinePageHeader* offline_header() { return offline_header_.get(); }
|
| +
|
| + bool is_offline_preview() { return is_offline_preview_; }
|
| +
|
| + private:
|
| + // The cached copy of OfflinePageItem.
|
| + std::unique_ptr<OfflinePageItem> offline_page_;
|
| +
|
| + // The offline header that is provided when offline page is loaded.
|
| + std::unique_ptr<OfflinePageHeader> offline_header_;
|
| +
|
| + // Whether the offline page was navigated to as a preview. Previews are shown
|
| + // when the user is on a prohibitively slow network.
|
| + bool is_offline_preview_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(LoadedOfflinePageInfo);
|
| +};
|
| +
|
| +} // namespace offline_pages
|
| +
|
| +#endif // COMPONENTS_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
|
|
|