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 (base::LowerCaseEqualsASCII(rel, "icon") || | 149 if (LowerCaseEqualsASCII(rel, "icon") || |
150 base::LowerCaseEqualsASCII(rel, "shortcut icon") || | 150 LowerCaseEqualsASCII(rel, "shortcut icon") || |
151 (CommandLine::ForCurrentProcess()-> | 151 (CommandLine::ForCurrentProcess()-> |
152 HasSwitch(switches::kEnableStreamlinedHostedApps) && | 152 HasSwitch(switches::kEnableStreamlinedHostedApps) && |
153 (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || | 153 (LowerCaseEqualsASCII(rel, "apple-touch-icon") || |
154 base::LowerCaseEqualsASCII(rel, | 154 LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { |
155 "apple-touch-icon-precomposed")))) { | |
156 AddInstallIcon(elem, &app_info->icons); | 155 AddInstallIcon(elem, &app_info->icons); |
157 } | 156 } |
158 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { | 157 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { |
159 std::string name = elem.getAttribute("name").utf8(); | 158 std::string name = elem.getAttribute("name").utf8(); |
160 WebString content = elem.getAttribute("content"); | 159 WebString content = elem.getAttribute("content"); |
161 if (name == "application-name") { | 160 if (name == "application-name") { |
162 app_info->title = content; | 161 app_info->title = content; |
163 } else if (name == "description") { | 162 } else if (name == "description") { |
164 app_info->description = content; | 163 app_info->description = content; |
165 } else if (name == "application-url") { | 164 } else if (name == "application-url") { |
166 std::string url = content.utf8(); | 165 std::string url = content.utf8(); |
167 app_info->app_url = document_url.is_valid() ? | 166 app_info->app_url = document_url.is_valid() ? |
168 document_url.Resolve(url) : GURL(url); | 167 document_url.Resolve(url) : GURL(url); |
169 if (!app_info->app_url.is_valid()) | 168 if (!app_info->app_url.is_valid()) |
170 app_info->app_url = GURL(); | 169 app_info->app_url = GURL(); |
171 } | 170 } |
172 } | 171 } |
173 } | 172 } |
174 | 173 |
175 return true; | 174 return true; |
176 } | 175 } |
177 | 176 |
178 } // namespace web_apps | 177 } // namespace web_apps |
OLD | NEW |