| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/dom_operations.h" | 5 #include "webkit/glue/dom_operations.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 result->resources_list->push_back(u); | 99 result->resources_list->push_back(u); |
| 100 // Insert referrer for above new resource link. | 100 // Insert referrer for above new resource link. |
| 101 result->referrer_urls_list->push_back(GURL()); | 101 result->referrer_urls_list->push_back(GURL()); |
| 102 result->referrer_policies_list->push_back(WebKit::WebReferrerPolicyDefault); | 102 result->referrer_policies_list->push_back(WebKit::WebReferrerPolicyDefault); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Get all savable resource links from current WebFrameImpl object pointer. | 105 // Get all savable resource links from current WebFrameImpl object pointer. |
| 106 void GetAllSavableResourceLinksForFrame(WebFrame* current_frame, | 106 void GetAllSavableResourceLinksForFrame(WebFrame* current_frame, |
| 107 SavableResourcesUniqueCheck* unique_check, | 107 SavableResourcesUniqueCheck* unique_check, |
| 108 webkit_glue::SavableResourcesResult* result, | 108 webkit_glue::SavableResourcesResult* result, |
| 109 const char** savable_schemes) { | 109 const char* const* savable_schemes) { |
| 110 // Get current frame's URL. | 110 // Get current frame's URL. |
| 111 GURL current_frame_url = current_frame->document().url(); | 111 GURL current_frame_url = current_frame->document().url(); |
| 112 | 112 |
| 113 // If url of current frame is invalid, ignore it. | 113 // If url of current frame is invalid, ignore it. |
| 114 if (!current_frame_url.is_valid()) | 114 if (!current_frame_url.is_valid()) |
| 115 return; | 115 return; |
| 116 | 116 |
| 117 // If url of current frame is not a savable protocol, ignore it. | 117 // If url of current frame is not a savable protocol, ignore it. |
| 118 bool is_valid_protocol = false; | 118 bool is_valid_protocol = false; |
| 119 for (int i = 0; savable_schemes[i] != NULL; ++i) { | 119 for (int i = 0; savable_schemes[i] != NULL; ++i) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 !StartsWithASCII(value.utf8(), "javascript:", false)) | 189 !StartsWithASCII(value.utf8(), "javascript:", false)) |
| 190 return value; | 190 return value; |
| 191 | 191 |
| 192 return WebString(); | 192 return WebString(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Get all savable resource links from current webview, include main | 195 // Get all savable resource links from current webview, include main |
| 196 // frame and sub-frame | 196 // frame and sub-frame |
| 197 bool GetAllSavableResourceLinksForCurrentPage(WebView* view, | 197 bool GetAllSavableResourceLinksForCurrentPage(WebView* view, |
| 198 const GURL& page_url, SavableResourcesResult* result, | 198 const GURL& page_url, SavableResourcesResult* result, |
| 199 const char** savable_schemes) { | 199 const char* const* savable_schemes) { |
| 200 WebFrame* main_frame = view->mainFrame(); | 200 WebFrame* main_frame = view->mainFrame(); |
| 201 if (!main_frame) | 201 if (!main_frame) |
| 202 return false; | 202 return false; |
| 203 | 203 |
| 204 std::set<GURL> resources_set; | 204 std::set<GURL> resources_set; |
| 205 std::set<GURL> frames_set; | 205 std::set<GURL> frames_set; |
| 206 std::vector<WebFrame*> frames; | 206 std::vector<WebFrame*> frames; |
| 207 SavableResourcesUniqueCheck unique_check(&resources_set, | 207 SavableResourcesUniqueCheck unique_check(&resources_set, |
| 208 &frames_set, | 208 &frames_set, |
| 209 &frames); | 209 &frames); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 if (!element.hasTagName("meta")) | 328 if (!element.hasTagName("meta")) |
| 329 continue; | 329 continue; |
| 330 WebString value = element.getAttribute(attribute_name); | 330 WebString value = element.getAttribute(attribute_name); |
| 331 if (value.isNull() || value != attribute_value) | 331 if (value.isNull() || value != attribute_value) |
| 332 continue; | 332 continue; |
| 333 meta_elements->push_back(element); | 333 meta_elements->push_back(element); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // webkit_glue | 337 } // webkit_glue |
| OLD | NEW |