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

Unified Diff: chrome/browser/android/offline_pages/offline_page_request_job.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/offline_page_request_job.h
diff --git a/chrome/browser/android/offline_pages/offline_page_request_job.h b/chrome/browser/android/offline_pages/offline_page_request_job.h
index c02d5a608663348fa5cbb59efc0259ffb5656eae..2b5d1e8f8ab74cdfc3b0b9d41db7264e8adb492f 100644
--- a/chrome/browser/android/offline_pages/offline_page_request_job.h
+++ b/chrome/browser/android/offline_pages/offline_page_request_job.h
@@ -1,31 +1,35 @@
// 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_JOB_H_
#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_
+#include <memory>
+
#include "base/memory/weak_ptr.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/common/resource_type.h"
#include "net/url_request/url_request_file_job.h"
namespace base {
class FilePath;
}
namespace previews {
class PreviewsDecider;
}
namespace offline_pages {
+struct OfflinePageHeader;
+struct OfflinePageItem;
// A request job that serves content from offline file.
class OfflinePageRequestJob : public net::URLRequestFileJob {
public:
// This enum is used for UMA reporting. It contains all possible outcomes of
// handling requests that might service offline page in different network
// conditions. Generally one of these outcomes will happen.
// The fringe errors (like no OfflinePageModel, etc.) are not reported due
// to their low probability.
// NOTE: because this is used for UMA reporting, these values should not be
@@ -73,37 +77,43 @@ class OfflinePageRequestJob : public net::URLRequestFileJob {
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
previews::PreviewsDecider* previews_decider);
~OfflinePageRequestJob() override;
// net::URLRequestJob overrides:
void Start() override;
void Kill() override;
- void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path);
+ void OnOfflineFilePathAvailable(
+ const base::FilePath& offline_file_path,
+ std::unique_ptr<OfflinePageHeader> offline_header,
+ std::unique_ptr<OfflinePageItem> offline_page);
void SetDelegateForTesting(std::unique_ptr<Delegate> delegate);
private:
OfflinePageRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
previews::PreviewsDecider* previews_decider);
void StartAsync();
// Restarts the request job in order to fall back to the default handling.
void FallbackToDefault();
std::unique_ptr<Delegate> delegate_;
// Used to determine if an URLRequest is eligible for offline previews.
previews::PreviewsDecider* previews_decider_;
+ // Was this job started as an offline preview.
+ bool was_started_as_preview_;
+
base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob);
};
} // namespace offline_pages
#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698