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

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

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Address review comments 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 #include "content/browser/appcache/appcache_navigation_handle_core.h"
6
7 #include <utility>
8
9 #include "base/bind.h"
10 #include "content/browser/appcache/appcache_dispatcher_host.h"
11 #include "content/browser/appcache/appcache_host.h"
12 #include "content/browser/appcache/appcache_navigation_handle.h"
13 #include "content/browser/appcache/appcache_service_impl.h"
14 #include "content/browser/appcache/chrome_appcache_service.h"
15
16 namespace content {
17
18 AppCacheNavigationHandleCore::AppCacheNavigationHandleCore(
19 base::WeakPtr<AppCacheNavigationHandle> ui_handle,
20 ChromeAppCacheService* appcache_service,
21 int appcache_host_id)
22 : appcache_service_(appcache_service),
23 appcache_host_id_(appcache_host_id),
24 ui_handle_(ui_handle) {
25 // The AppCacheNavigationHandleCore is created on the UI thread but
26 // should only be accessed from the IO thread afterwards.
27 DCHECK_CURRENTLY_ON(BrowserThread::UI);
28 }
29
30 AppCacheNavigationHandleCore::~AppCacheNavigationHandleCore() {
31 DCHECK_CURRENTLY_ON(BrowserThread::IO);
32 if (precreated_host_.get())
33 precreated_host_.reset(nullptr);
34 }
35
36 void AppCacheNavigationHandleCore::Initialize() {
37 DCHECK_CURRENTLY_ON(BrowserThread::IO);
38 DCHECK(precreated_host_.get() == nullptr);
39 precreated_host_.reset(new AppCacheHost(appcache_host_id_,
40 this,
41 GetAppCacheService()));
42 }
43
44 void AppCacheNavigationHandleCore::CommitNavigation(int process_id) {
45 scoped_refptr<AppCacheDispatcherHost> dispatcher_host =
46 AppCacheDispatcherHost::GetHostForProcess(process_id);
47 // We release ownership of the precreated_host_ here. From this point on
48 // the AppCacheBackendImpl class owns the host.
49 if (dispatcher_host.get())
50 dispatcher_host->RegisterPrecreatedHost(std::move(precreated_host_));
51 }
52
53 AppCacheServiceImpl* AppCacheNavigationHandleCore::GetAppCacheService() {
54 return static_cast<AppCacheServiceImpl*>(appcache_service_.get());
55 }
56
57 void AppCacheNavigationHandleCore::OnCacheSelected(int host_id,
58 const AppCacheInfo& info) {
59 DCHECK(false);
60 }
61
62 void AppCacheNavigationHandleCore::OnStatusChanged(
63 const std::vector<int>& host_ids,
64 AppCacheStatus status) {
65 // Should never be called.
66 DCHECK(false);
67 }
68
69 void AppCacheNavigationHandleCore::OnEventRaised(
70 const std::vector<int>& host_ids,
71 AppCacheEventID event_id) {
72 // Should never be called.
73 DCHECK(false);
74 }
75
76 void AppCacheNavigationHandleCore::OnProgressEventRaised(
77 const std::vector<int>& host_ids,
78 const GURL& url,
79 int num_total,
80 int num_complete) {
81 // Should never be called.
82 DCHECK(false);
83 }
84
85 void AppCacheNavigationHandleCore::OnErrorEventRaised(
86 const std::vector<int>& host_ids,
87 const AppCacheErrorDetails& details) {
88 // Should never be called.
89 DCHECK(false);
90 }
91
92 void AppCacheNavigationHandleCore::OnLogMessage(int host_id,
93 AppCacheLogLevel log_level,
94 const std::string& message) {
95 // Should never be called.
96 DCHECK(false);
97 }
98
99 void AppCacheNavigationHandleCore::OnContentBlocked(int host_id,
100 const GURL& manifest_url) {
101 // Should never be called.
102 DCHECK(false);
103 }
104
105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698