Index: content/browser/appcache/appcache_navigation_handle_core.h |
diff --git a/content/browser/appcache/appcache_navigation_handle_core.h b/content/browser/appcache/appcache_navigation_handle_core.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca5644c24ade046114e274b9feeeed5b9b82a51e |
--- /dev/null |
+++ b/content/browser/appcache/appcache_navigation_handle_core.h |
@@ -0,0 +1,80 @@ |
+// 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 CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_ |
+#define CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "content/common/appcache_interfaces.h" |
+ |
+namespace content { |
+ |
+class AppCacheNavigationHandle; |
+class AppCacheHost; |
+class AppCacheServiceImpl; |
+class ChromeAppCacheService; |
+ |
+// PlzNavigate |
+// This class is used to manage the lifetime of AppCacheHosts |
+// created during navigations. This class is created on the UI thread, but |
+// should only be accessed from the IO thread afterwards. It is the IO thread |
+// pendant of AppCacheNavigationHandle. See the |
+// AppCacheNavigationHandle header for more details about the lifetime of |
+// both classes. |
+class AppCacheNavigationHandleCore : public AppCacheFrontend { |
+ public: |
+ AppCacheNavigationHandleCore( |
+ base::WeakPtr<AppCacheNavigationHandle> ui_handle, |
+ ChromeAppCacheService* appcache_service, |
+ int appcache_host_id); |
+ ~AppCacheNavigationHandleCore() override; |
+ |
+ // Returns the raw AppCacheHost pointer. Ownership remains with this class. |
+ AppCacheHost* host() { return precreated_host_.get(); } |
+ |
+ // Initializes this instance. Should be called on the IO thread. |
+ void Initialize(); |
+ |
+ // Called when a navigation is committed. The |process_id| parameter is |
+ // is the process id of the renderer. |
+ void CommitNavigation(int process_id); |
+ |
+ AppCacheServiceImpl* GetAppCacheService(); |
+ |
+ protected: |
+ // AppCacheFrontend methods |
+ // We don't expect calls on the AppCacheFrontend methods while the |
+ // AppCacheHost is not registered with the AppCacheBackend. |
+ void OnCacheSelected(int host_id, const AppCacheInfo& info) override; |
+ void OnStatusChanged(const std::vector<int>& host_ids, |
+ AppCacheStatus status) override; |
+ void OnEventRaised(const std::vector<int>& host_ids, |
+ AppCacheEventID event_id) override; |
+ void OnProgressEventRaised(const std::vector<int>& host_ids, |
+ const GURL& url, |
+ int num_total, |
+ int num_complete) override; |
+ void OnErrorEventRaised(const std::vector<int>& host_ids, |
+ const AppCacheErrorDetails& details) override; |
+ void OnLogMessage(int host_id, |
+ AppCacheLogLevel log_level, |
+ const std::string& message) override; |
+ void OnContentBlocked(int host_id, const GURL& manifest_url) override; |
+ |
+ private: |
+ std::unique_ptr<AppCacheHost> precreated_host_; |
+ scoped_refptr<ChromeAppCacheService> appcache_service_; |
+ int appcache_host_id_; |
+ base::WeakPtr<AppCacheNavigationHandle> ui_handle_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppCacheNavigationHandleCore); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_ |