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

Side by Side Diff: content/browser/appcache/appcache_navigation_handle_core.h

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Rebase to tip correctly Created 4 years 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 CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/common/appcache_interfaces.h"
14
15 namespace content {
16
17 class AppCacheNavigationHandle;
18 class AppCacheHost;
19 class AppCacheServiceImpl;
20 class ChromeAppCacheService;
21
22 // PlzNavigate
23 // This class is used to manage the lifetime of AppCacheHosts
24 // created during navigations. This class is created on the UI thread, but
25 // should only be accessed from the IO thread afterwards. It is the IO thread
26 // pendant of AppCacheNavigationHandle. See the
27 // AppCacheNavigationHandle header for more details about the lifetime of
28 // both classes.
29 class AppCacheNavigationHandleCore : public AppCacheFrontend {
30 public:
31 AppCacheNavigationHandleCore(
32 base::WeakPtr<AppCacheNavigationHandle> ui_handle,
33 ChromeAppCacheService* appcache_service,
34 int appcache_host_id);
35 ~AppCacheNavigationHandleCore() override;
36
37 // Returns the raw AppCacheHost pointer. Ownership remains with this class.
38 AppCacheHost* host() { return precreated_host_.get(); }
39
40 // Initializes this instance. Should be called on the IO thread.
41 void Initialize();
42
43 // Called when a navigation is committed. The |process_id| parameter is
44 // is the process id of the renderer.
45 void CommitNavigation(int process_id);
46
47 AppCacheServiceImpl* GetAppCacheService();
48
49 // AppCacheFrontend methods
michaeln 2016/12/03 00:58:58 i'd vote to make these 'private' or 'protected' si
ananta 2016/12/03 14:55:04 Changed to protected:
50 // We don't expect calls on the AppCacheFrontend methods while the
51 // AppCacheHost is not registered with the AppCacheBackend.
52 void OnCacheSelected(int host_id, const AppCacheInfo& info) override;
53 void OnStatusChanged(const std::vector<int>& host_ids,
54 AppCacheStatus status) override;
55 void OnEventRaised(const std::vector<int>& host_ids,
56 AppCacheEventID event_id) override;
57 void OnProgressEventRaised(const std::vector<int>& host_ids,
58 const GURL& url,
59 int num_total,
60 int num_complete) override;
61 void OnErrorEventRaised(const std::vector<int>& host_ids,
62 const AppCacheErrorDetails& details) override;
63 void OnLogMessage(int host_id,
64 AppCacheLogLevel log_level,
65 const std::string& message) override;
66 void OnContentBlocked(int host_id, const GURL& manifest_url) override;
67
68 private:
69 std::unique_ptr<AppCacheHost> precreated_host_;
70 scoped_refptr<ChromeAppCacheService> appcache_service_;
71 int appcache_host_id_;
72 base::WeakPtr<AppCacheNavigationHandle> ui_handle_;
73
74 DISALLOW_COPY_AND_ASSIGN(AppCacheNavigationHandleCore);
75 };
76
77 } // namespace content
78
79 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698