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

Unified Diff: chrome/browser/android/offline_pages/offline_page_request_offline_job.h

Issue 2002433002: Handle online and offline redirects via interceptor and offline scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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_offline_job.h
diff --git a/chrome/browser/android/offline_pages/offline_page_request_offline_job.h b/chrome/browser/android/offline_pages/offline_page_request_offline_job.h
new file mode 100644
index 0000000000000000000000000000000000000000..016a46436eaee467af15d4d7d8bca0fd9fa8ff6e
--- /dev/null
+++ b/chrome/browser/android/offline_pages/offline_page_request_offline_job.h
@@ -0,0 +1,45 @@
+// 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_OFFLINE_JOB_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_OFFLINE_JOB_H_
+
+#include "base/memory/weak_ptr.h"
+#include "net/base/net_errors.h"
+#include "net/http/http_byte_range.h"
+#include "net/url_request/url_request_file_job.h"
+#include "url/gurl.h"
+
+namespace base {
+class FilePath;
+}
+
+namespace offline_pages {
+
+// A request job that serves content from backing file for URLs with offline
+// scheme.
+class OfflinePageRequestOfflineJob : public net::URLRequestFileJob {
+ public:
+ OfflinePageRequestOfflineJob(void* profile_id,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
+ ~OfflinePageRequestOfflineJob() override;
+
+ // net::URLRequestJob overrides:
+ void Start() override;
+ void Kill() override;
+
+ private:
+ void StartAsync();
+ void LoadFile(const base::FilePath& offline_file_path);
+
+ void* profile_id_;
+ base::WeakPtrFactory<OfflinePageRequestOfflineJob> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestOfflineJob);
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_OFFLINE_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698