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

Side by Side Diff: content/renderer/savable_resources.cc

Issue 23064011: Consolidate scheme checks into an easy GURL method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « content/renderer/npapi/webplugin_impl.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/renderer/savable_resources.h" 5 #include "content/renderer/savable_resources.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (value.isNull()) 82 if (value.isNull())
83 return; 83 return;
84 // Get absolute URL. 84 // Get absolute URL.
85 GURL u = current_doc.completeURL(value); 85 GURL u = current_doc.completeURL(value);
86 // ignore invalid URL 86 // ignore invalid URL
87 if (!u.is_valid()) 87 if (!u.is_valid())
88 return; 88 return;
89 // Ignore those URLs which are not standard protocols. Because FTP 89 // Ignore those URLs which are not standard protocols. Because FTP
90 // protocol does no have cache mechanism, we will skip all 90 // protocol does no have cache mechanism, we will skip all
91 // sub-resources if they use FTP protocol. 91 // sub-resources if they use FTP protocol.
92 if (!u.SchemeIs("http") && !u.SchemeIs("https") && !u.SchemeIs("file")) 92 if (!u.SchemeIsHTTPOrHTTPS() && !u.SchemeIs("file"))
93 return; 93 return;
94 // Ignore duplicated resource link. 94 // Ignore duplicated resource link.
95 if (!unique_check->resources_set->insert(u).second) 95 if (!unique_check->resources_set->insert(u).second)
96 return; 96 return;
97 result->resources_list->push_back(u); 97 result->resources_list->push_back(u);
98 // Insert referrer for above new resource link. 98 // Insert referrer for above new resource link.
99 result->referrer_urls_list->push_back(GURL()); 99 result->referrer_urls_list->push_back(GURL());
100 result->referrer_policies_list->push_back(WebKit::WebReferrerPolicyDefault); 100 result->referrer_policies_list->push_back(WebKit::WebReferrerPolicyDefault);
101 } 101 }
102 102
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 it != frames_set.end(); ++it) { 229 it != frames_set.end(); ++it) {
230 // Append unique frame source to savable frame list. 230 // Append unique frame source to savable frame list.
231 if (resources_set.find(*it) == resources_set.end()) 231 if (resources_set.find(*it) == resources_set.end())
232 result->frames_list->push_back(*it); 232 result->frames_list->push_back(*it);
233 } 233 }
234 234
235 return true; 235 return true;
236 } 236 }
237 237
238 } // namespace content 238 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/npapi/webplugin_impl.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698