| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::LowerCaseEqualsASCII(rel, "shortcut icon") || | 160 base::LowerCaseEqualsASCII(rel, "shortcut icon") || |
| 161 (bookmark_apps_enabled && | 161 (bookmark_apps_enabled && |
| 162 (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || | 162 (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || |
| 163 base::LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { | 163 base::LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { |
| 164 AddInstallIcon(elem, &app_info->icons); | 164 AddInstallIcon(elem, &app_info->icons); |
| 165 } | 165 } |
| 166 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { | 166 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { |
| 167 std::string name = elem.getAttribute("name").utf8(); | 167 std::string name = elem.getAttribute("name").utf8(); |
| 168 WebString content = elem.getAttribute("content"); | 168 WebString content = elem.getAttribute("content"); |
| 169 if (name == "application-name") { | 169 if (name == "application-name") { |
| 170 app_info->title = content; | 170 app_info->title = content.utf16(); |
| 171 } else if (name == "description") { | 171 } else if (name == "description") { |
| 172 app_info->description = content; | 172 app_info->description = content.utf16(); |
| 173 } else if (name == "application-url") { | 173 } else if (name == "application-url") { |
| 174 std::string url = content.utf8(); | 174 std::string url = content.utf8(); |
| 175 app_info->app_url = document_url.is_valid() ? | 175 app_info->app_url = document_url.is_valid() ? |
| 176 document_url.Resolve(url) : GURL(url); | 176 document_url.Resolve(url) : GURL(url); |
| 177 if (!app_info->app_url.is_valid()) | 177 if (!app_info->app_url.is_valid()) |
| 178 app_info->app_url = GURL(); | 178 app_info->app_url = GURL(); |
| 179 } else if (name == "mobile-web-app-capable" && | 179 } else if (name == "mobile-web-app-capable" && |
| 180 base::LowerCaseEqualsASCII(base::StringPiece16(content), | 180 base::LowerCaseEqualsASCII(content.utf16(), "yes")) { |
| 181 "yes")) { | |
| 182 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; | 181 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; |
| 183 } else if (name == "apple-mobile-web-app-capable" && | 182 } else if (name == "apple-mobile-web-app-capable" && |
| 184 base::LowerCaseEqualsASCII( | 183 base::LowerCaseEqualsASCII(content.utf16(), "yes") && |
| 185 base::StringPiece16(content), "yes") && | |
| 186 app_info->mobile_capable == | 184 app_info->mobile_capable == |
| 187 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { | 185 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { |
| 188 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; | 186 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; |
| 189 } | 187 } |
| 190 } | 188 } |
| 191 } | 189 } |
| 192 } | 190 } |
| 193 | 191 |
| 194 } // namespace web_apps | 192 } // namespace web_apps |
| OLD | NEW |