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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // | 145 // |
146 // Bookmark apps also support "apple-touch-icon" and | 146 // Bookmark apps also support "apple-touch-icon" and |
147 // "apple-touch-icon-precomposed". | 147 // "apple-touch-icon-precomposed". |
148 #if defined(OS_MACOSX) | 148 #if defined(OS_MACOSX) |
149 bool bookmark_apps_enabled = base::CommandLine::ForCurrentProcess()-> | 149 bool bookmark_apps_enabled = base::CommandLine::ForCurrentProcess()-> |
150 HasSwitch(switches::kEnableNewBookmarkApps); | 150 HasSwitch(switches::kEnableNewBookmarkApps); |
151 #else | 151 #else |
152 bool bookmark_apps_enabled = !base::CommandLine::ForCurrentProcess()-> | 152 bool bookmark_apps_enabled = !base::CommandLine::ForCurrentProcess()-> |
153 HasSwitch(switches::kDisableNewBookmarkApps); | 153 HasSwitch(switches::kDisableNewBookmarkApps); |
154 #endif | 154 #endif |
155 if (LowerCaseEqualsASCII(rel, "icon") || | 155 if (base::LowerCaseEqualsASCII(rel, "icon") || |
156 LowerCaseEqualsASCII(rel, "shortcut icon") || | 156 base::LowerCaseEqualsASCII(rel, "shortcut icon") || |
157 (bookmark_apps_enabled && | 157 (bookmark_apps_enabled && |
158 (LowerCaseEqualsASCII(rel, "apple-touch-icon") || | 158 (base::LowerCaseEqualsASCII(rel, "apple-touch-icon") || |
159 LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { | 159 base::LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { |
160 AddInstallIcon(elem, &app_info->icons); | 160 AddInstallIcon(elem, &app_info->icons); |
161 } | 161 } |
162 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { | 162 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { |
163 std::string name = elem.getAttribute("name").utf8(); | 163 std::string name = elem.getAttribute("name").utf8(); |
164 WebString content = elem.getAttribute("content"); | 164 WebString content = elem.getAttribute("content"); |
165 if (name == "application-name") { | 165 if (name == "application-name") { |
166 app_info->title = content; | 166 app_info->title = content; |
167 } else if (name == "description") { | 167 } else if (name == "description") { |
168 app_info->description = content; | 168 app_info->description = content; |
169 } else if (name == "application-url") { | 169 } else if (name == "application-url") { |
170 std::string url = content.utf8(); | 170 std::string url = content.utf8(); |
171 app_info->app_url = document_url.is_valid() ? | 171 app_info->app_url = document_url.is_valid() ? |
172 document_url.Resolve(url) : GURL(url); | 172 document_url.Resolve(url) : GURL(url); |
173 if (!app_info->app_url.is_valid()) | 173 if (!app_info->app_url.is_valid()) |
174 app_info->app_url = GURL(); | 174 app_info->app_url = GURL(); |
175 } else if (name == "mobile-web-app-capable" && | 175 } else if (name == "mobile-web-app-capable" && |
176 LowerCaseEqualsASCII(content, "yes")) { | 176 base::LowerCaseEqualsASCII(content, "yes")) { |
177 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; | 177 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE; |
178 } else if (name == "apple-mobile-web-app-capable" && | 178 } else if (name == "apple-mobile-web-app-capable" && |
179 LowerCaseEqualsASCII(content, "yes") && | 179 base::LowerCaseEqualsASCII(content, "yes") && |
180 app_info->mobile_capable == | 180 app_info->mobile_capable == |
181 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { | 181 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { |
182 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; | 182 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 } // namespace web_apps | 188 } // namespace web_apps |
OLD | NEW |