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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 if (elem.hasHTMLTagName("link")) { | 140 if (elem.hasHTMLTagName("link")) { |
141 std::string rel = elem.getAttribute("rel").utf8(); | 141 std::string rel = elem.getAttribute("rel").utf8(); |
142 // "rel" attribute may use either "icon" or "shortcut icon". | 142 // "rel" attribute may use either "icon" or "shortcut icon". |
143 // see also | 143 // see also |
144 // <http://en.wikipedia.org/wiki/Favicon> | 144 // <http://en.wikipedia.org/wiki/Favicon> |
145 // <http://dev.w3.org/html5/spec/Overview.html#rel-icon> | 145 // <http://dev.w3.org/html5/spec/Overview.html#rel-icon> |
146 // | 146 // |
147 // Streamlined Hosted Apps also support "apple-touch-icon" and | 147 // Streamlined Hosted Apps also support "apple-touch-icon" and |
148 // "apple-touch-icon-precomposed". | 148 // "apple-touch-icon-precomposed". |
149 if (LowerCaseEqualsASCII(rel, "icon") || | 149 if (base::LowerCaseEqualsASCII(rel, "icon") || |
150 LowerCaseEqualsASCII(rel, "shortcut icon") || | 150 base::LowerCaseEqualsASCII(rel, "shortcut icon") || |
151 (CommandLine::ForCurrentProcess()-> | 151 (CommandLine::ForCurrentProcess()-> |
152 HasSwitch(switches::kEnableStreamlinedHostedApps) && | 152 HasSwitch(switches::kEnableStreamlinedHostedApps) && |
153 (LowerCaseEqualsASCII(rel, "apple-touch-icon") || | 153 (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || |
154 LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { | 154 base::LowerCaseEqualsASCII(rel, |
| 155 "apple-touch-icon-precomposed")))) { |
155 AddInstallIcon(elem, &app_info->icons); | 156 AddInstallIcon(elem, &app_info->icons); |
156 } | 157 } |
157 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { | 158 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { |
158 std::string name = elem.getAttribute("name").utf8(); | 159 std::string name = elem.getAttribute("name").utf8(); |
159 WebString content = elem.getAttribute("content"); | 160 WebString content = elem.getAttribute("content"); |
160 if (name == "application-name") { | 161 if (name == "application-name") { |
161 app_info->title = content; | 162 app_info->title = content; |
162 } else if (name == "description") { | 163 } else if (name == "description") { |
163 app_info->description = content; | 164 app_info->description = content; |
164 } else if (name == "application-url") { | 165 } else if (name == "application-url") { |
165 std::string url = content.utf8(); | 166 std::string url = content.utf8(); |
166 app_info->app_url = document_url.is_valid() ? | 167 app_info->app_url = document_url.is_valid() ? |
167 document_url.Resolve(url) : GURL(url); | 168 document_url.Resolve(url) : GURL(url); |
168 if (!app_info->app_url.is_valid()) | 169 if (!app_info->app_url.is_valid()) |
169 app_info->app_url = GURL(); | 170 app_info->app_url = GURL(); |
170 } | 171 } |
171 } | 172 } |
172 } | 173 } |
173 | 174 |
174 return true; | 175 return true; |
175 } | 176 } |
176 | 177 |
177 } // namespace web_apps | 178 } // namespace web_apps |
OLD | NEW |