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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_loader.h

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string>
10 #include <vector>
9 11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "chrome/browser/android/offline_pages/prerender_adapter.h" 13 #include "chrome/browser/android/offline_pages/prerender_adapter.h"
12 #include "components/offline_pages/core/background/offliner.h" 14 #include "components/offline_pages/core/background/offliner.h"
13 #include "components/offline_pages/core/snapshot_controller.h" 15 #include "components/offline_pages/core/snapshot_controller.h"
14 16
15 class GURL; 17 class GURL;
16 18
17 namespace content { 19 namespace content {
18 class BrowserContext; 20 class BrowserContext;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 std::unique_ptr<PrerenderAdapter> prerender_adapter); 69 std::unique_ptr<PrerenderAdapter> prerender_adapter);
68 70
69 // PrerenderAdapter::Observer implementation: 71 // PrerenderAdapter::Observer implementation:
70 void OnPrerenderStopLoading() override; 72 void OnPrerenderStopLoading() override;
71 void OnPrerenderDomContentLoaded() override; 73 void OnPrerenderDomContentLoaded() override;
72 void OnPrerenderStop() override; 74 void OnPrerenderStop() override;
73 75
74 // SnapshotController::Client implementation: 76 // SnapshotController::Client implementation:
75 void StartSnapshot() override; 77 void StartSnapshot() override;
76 78
79 // TODO: Is this heavyweight enough I should move it instead of copying?
80 const std::vector<std::string>& GetSignalData() { return signal_data_; }
81
77 private: 82 private:
78 // State of the loader (only one request may be active at a time). 83 // State of the loader (only one request may be active at a time).
79 enum class State { 84 enum class State {
80 IDLE, // No active load request. 85 IDLE, // No active load request.
81 PENDING, // Load request is pending the start of prerendering. 86 PENDING, // Load request is pending the start of prerendering.
82 LOADING, // Loading in progress. 87 LOADING, // Loading in progress.
83 LOADED, // Loaded and now waiting for requestor to StopLoading(). 88 LOADED, // Loaded and now waiting for requestor to StopLoading().
84 }; 89 };
85 90
86 // Handles some event/signal that the load request has succeeded or failed. 91 // Handles some event/signal that the load request has succeeded or failed.
(...skipping 18 matching lines...) Expand all
105 // Not owned. 110 // Not owned.
106 content::BrowserContext* browser_context_; 111 content::BrowserContext* browser_context_;
107 112
108 // Adapter for handling calls to the prerender stack. 113 // Adapter for handling calls to the prerender stack.
109 std::unique_ptr<PrerenderAdapter> adapter_; 114 std::unique_ptr<PrerenderAdapter> adapter_;
110 115
111 // A WebContents for the active load request that is used to hold the session 116 // A WebContents for the active load request that is used to hold the session
112 // storage namespace for rendering. This will NOT have the loaded page. 117 // storage namespace for rendering. This will NOT have the loaded page.
113 std::unique_ptr<content::WebContents> session_contents_; 118 std::unique_ptr<content::WebContents> session_contents_;
114 119
120 // Signal data collected for this rendering attempt
121 std::vector<std::string> signal_data_;
122
115 // Callback to call when the active load request completes, fails, or is 123 // Callback to call when the active load request completes, fails, or is
116 // canceled. 124 // canceled.
117 LoadPageCallback callback_; 125 LoadPageCallback callback_;
118 126
119 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); 127 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader);
120 }; 128 };
121 129
122 } // namespace offline_pages 130 } // namespace offline_pages
123 131
124 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 132 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698