| 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 "chrome/renderer/web_apps.h" | 5 #include "chrome/renderer/web_apps.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 sizes->push_back(size); | 111 sizes->push_back(size); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 if (*is_any && !sizes->empty()) { | 114 if (*is_any && !sizes->empty()) { |
| 115 // If is_any is true, it must occur by itself. | 115 // If is_any is true, it must occur by itself. |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 return (*is_any || !sizes->empty()); | 118 return (*is_any || !sizes->empty()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool ParseWebAppFromWebDocument(WebFrame* frame, | 121 void ParseWebAppFromWebDocument(WebFrame* frame, |
| 122 WebApplicationInfo* app_info, | 122 WebApplicationInfo* app_info) { |
| 123 base::string16* error) { | |
| 124 WebDocument document = frame->document(); | 123 WebDocument document = frame->document(); |
| 125 if (document.isNull()) | 124 if (document.isNull()) |
| 126 return true; | 125 return; |
| 127 | 126 |
| 128 WebElement head = document.head(); | 127 WebElement head = document.head(); |
| 129 if (head.isNull()) | 128 if (head.isNull()) |
| 130 return true; | 129 return; |
| 131 | 130 |
| 132 GURL document_url = document.url(); | 131 GURL document_url = document.url(); |
| 133 WebNodeList children = head.childNodes(); | 132 WebNodeList children = head.childNodes(); |
| 134 for (unsigned i = 0; i < children.length(); ++i) { | 133 for (unsigned i = 0; i < children.length(); ++i) { |
| 135 WebNode child = children.item(i); | 134 WebNode child = children.item(i); |
| 136 if (!child.isElementNode()) | 135 if (!child.isElementNode()) |
| 137 continue; | 136 continue; |
| 138 WebElement elem = child.to<WebElement>(); | 137 WebElement elem = child.to<WebElement>(); |
| 139 | 138 |
| 140 if (elem.hasHTMLTagName("link")) { | 139 if (elem.hasHTMLTagName("link")) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 160 if (name == "application-name") { | 159 if (name == "application-name") { |
| 161 app_info->title = content; | 160 app_info->title = content; |
| 162 } else if (name == "description") { | 161 } else if (name == "description") { |
| 163 app_info->description = content; | 162 app_info->description = content; |
| 164 } else if (name == "application-url") { | 163 } else if (name == "application-url") { |
| 165 std::string url = content.utf8(); | 164 std::string url = content.utf8(); |
| 166 app_info->app_url = document_url.is_valid() ? | 165 app_info->app_url = document_url.is_valid() ? |
| 167 document_url.Resolve(url) : GURL(url); | 166 document_url.Resolve(url) : GURL(url); |
| 168 if (!app_info->app_url.is_valid()) | 167 if (!app_info->app_url.is_valid()) |
| 169 app_info->app_url = GURL(); | 168 app_info->app_url = GURL(); |
| 169 } else if (name == "mobile-web-app-capable" && |
| 170 LowerCaseEqualsASCII(content, "yes")) { |
| 171 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; |
| 172 } else if (name == "apple-mobile-web-app-capable" && |
| 173 LowerCaseEqualsASCII(content, "yes") && |
| 174 app_info->mobile_capable == |
| 175 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { |
| 176 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; |
| 170 } | 177 } |
| 171 } | 178 } |
| 172 } | 179 } |
| 173 | |
| 174 return true; | |
| 175 } | 180 } |
| 176 | 181 |
| 177 } // namespace web_apps | 182 } // namespace web_apps |
| OLD | NEW |