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

Side by Side Diff: content/child/appcache/web_application_cache_host_impl.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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/appcache/web_application_cache_host_impl.h" 5 #include "content/child/appcache/web_application_cache_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/id_map.h" 10 #include "base/id_map.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "content/public/common/browser_side_navigation_policy.h"
13 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
14 #include "third_party/WebKit/public/platform/WebURL.h" 15 #include "third_party/WebKit/public/platform/WebURL.h"
15 #include "third_party/WebKit/public/platform/WebURLRequest.h" 16 #include "third_party/WebKit/public/platform/WebURLRequest.h"
16 #include "third_party/WebKit/public/platform/WebURLResponse.h" 17 #include "third_party/WebKit/public/platform/WebURLResponse.h"
17 18
18 using blink::WebApplicationCacheHost; 19 using blink::WebApplicationCacheHost;
19 using blink::WebApplicationCacheHostClient; 20 using blink::WebApplicationCacheHostClient;
20 using blink::WebString; 21 using blink::WebString;
21 using blink::WebURLRequest; 22 using blink::WebURLRequest;
22 using blink::WebURL; 23 using blink::WebURL;
(...skipping 27 matching lines...) Expand all
50 } 51 }
51 52
52 } // anon namespace 53 } // anon namespace
53 54
54 WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromId(int id) { 55 WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromId(int id) {
55 return all_hosts()->Lookup(id); 56 return all_hosts()->Lookup(id);
56 } 57 }
57 58
58 WebApplicationCacheHostImpl::WebApplicationCacheHostImpl( 59 WebApplicationCacheHostImpl::WebApplicationCacheHostImpl(
59 WebApplicationCacheHostClient* client, 60 WebApplicationCacheHostClient* client,
60 AppCacheBackend* backend) 61 AppCacheBackend* backend,
62 int appcache_host_id)
61 : client_(client), 63 : client_(client),
62 backend_(backend), 64 backend_(backend),
63 host_id_(all_hosts()->Add(this)),
64 status_(APPCACHE_STATUS_UNCACHED), 65 status_(APPCACHE_STATUS_UNCACHED),
65 is_scheme_supported_(false), 66 is_scheme_supported_(false),
66 is_get_method_(false), 67 is_get_method_(false),
67 is_new_master_entry_(MAYBE), 68 is_new_master_entry_(MAYBE),
68 was_select_cache_called_(false) { 69 was_select_cache_called_(false) {
69 DCHECK(client && backend && (host_id_ != kAppCacheNoHostId)); 70 DCHECK(client && backend);
71 // PlzNavigate: The browser passes the ID to be used.
72 if (appcache_host_id != kAppCacheNoHostId) {
73 DCHECK(IsBrowserSideNavigationEnabled());
74 all_hosts()->AddWithID(this, appcache_host_id);
75 host_id_ = appcache_host_id;
76 } else {
77 host_id_ = all_hosts()->Add(this);
78 }
79 DCHECK(host_id_ != kAppCacheNoHostId);
70 80
71 backend_->RegisterHost(host_id_); 81 backend_->RegisterHost(host_id_);
72 } 82 }
73 83
74 WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() { 84 WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() {
75 backend_->UnregisterHost(host_id_); 85 backend_->UnregisterHost(host_id_);
76 all_hosts()->Remove(host_id_); 86 all_hosts()->Remove(host_id_);
77 } 87 }
78 88
79 void WebApplicationCacheHostImpl::OnCacheSelected( 89 void WebApplicationCacheHostImpl::OnCacheSelected(
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 web_resources[i].isExplicit = resource_infos[i].is_explicit; 326 web_resources[i].isExplicit = resource_infos[i].is_explicit;
317 web_resources[i].isManifest = resource_infos[i].is_manifest; 327 web_resources[i].isManifest = resource_infos[i].is_manifest;
318 web_resources[i].isForeign = resource_infos[i].is_foreign; 328 web_resources[i].isForeign = resource_infos[i].is_foreign;
319 web_resources[i].isFallback = resource_infos[i].is_fallback; 329 web_resources[i].isFallback = resource_infos[i].is_fallback;
320 web_resources[i].url = resource_infos[i].url; 330 web_resources[i].url = resource_infos[i].url;
321 } 331 }
322 resources->swap(web_resources); 332 resources->swap(web_resources);
323 } 333 }
324 334
325 } // namespace content 335 } // namespace content
OLDNEW
« no previous file with comments | « content/child/appcache/web_application_cache_host_impl.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698