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