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

Side by Side Diff: components/offline_pages/loaded_offline_page_info.h

Issue 2362033002: Showing previews UI for Offline Previews (Closed)
Patch Set: megjablon comments rebase Created 4 years, 2 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 2016 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_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
6 #define COMPONENTS_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/supports_user_data.h"
12
13 namespace net {
14 class URLRequest;
15 }
16
17 namespace offline_pages {
18
19 struct OfflinePageItem;
20 struct OfflinePageHeader;
21
22 // Contains the info about the offline page being loaded.
23 class LoadedOfflinePageInfo : public base::SupportsUserData::Data {
24 public:
25 LoadedOfflinePageInfo();
26 ~LoadedOfflinePageInfo() override;
27
28 std::unique_ptr<LoadedOfflinePageInfo> DeepCopy();
29
30 // static
31 static void CreateInfoForRequest(
32 net::URLRequest* request,
33 std::unique_ptr<OfflinePageItem> offline_page,
34 std::unique_ptr<OfflinePageHeader> offline_header,
35 bool is_offline_preview);
36
37 // static
38 static LoadedOfflinePageInfo* GetInfo(const net::URLRequest& request);
39
40 OfflinePageItem* offline_page() { return offline_page_.get(); }
41
42 OfflinePageHeader* offline_header() { return offline_header_.get(); }
43
44 bool is_offline_preview() { return is_offline_preview_; }
45
46 private:
47 // The cached copy of OfflinePageItem.
48 std::unique_ptr<OfflinePageItem> offline_page_;
49
50 // The offline header that is provided when offline page is loaded.
51 std::unique_ptr<OfflinePageHeader> offline_header_;
52
53 // Whether the offline page was navigated to as a preview. Previews are shown
54 // when the user is on a prohibitively slow network.
55 bool is_offline_preview_;
56
57 DISALLOW_COPY_AND_ASSIGN(LoadedOfflinePageInfo);
58 };
59
60 } // namespace offline_pages
61
62 #endif // COMPONENTS_OFFLINE_PAGES_LOADED_OFFLINE_PAGE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698