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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 if (elem.hasHTMLTagName("link")) { | 139 if (elem.hasHTMLTagName("link")) { |
140 std::string rel = elem.getAttribute("rel").utf8(); | 140 std::string rel = elem.getAttribute("rel").utf8(); |
141 // "rel" attribute may use either "icon" or "shortcut icon". | 141 // "rel" attribute may use either "icon" or "shortcut icon". |
142 // see also | 142 // see also |
143 // <http://en.wikipedia.org/wiki/Favicon> | 143 // <http://en.wikipedia.org/wiki/Favicon> |
144 // <http://dev.w3.org/html5/spec/Overview.html#rel-icon> | 144 // <http://dev.w3.org/html5/spec/Overview.html#rel-icon> |
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_CHROMEOS) |
| 149 bool bookmark_apps_enabled = !base::CommandLine::ForCurrentProcess()-> |
| 150 HasSwitch(switches::kDisableNewBookmarkApps); |
| 151 #else |
| 152 bool bookmark_apps_enabled = base::CommandLine::ForCurrentProcess()-> |
| 153 HasSwitch(switches::kEnableNewBookmarkApps); |
| 154 #endif |
148 if (LowerCaseEqualsASCII(rel, "icon") || | 155 if (LowerCaseEqualsASCII(rel, "icon") || |
149 LowerCaseEqualsASCII(rel, "shortcut icon") || | 156 LowerCaseEqualsASCII(rel, "shortcut icon") || |
150 (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 157 (bookmark_apps_enabled && |
151 switches::kDisableNewBookmarkApps) && | |
152 (LowerCaseEqualsASCII(rel, "apple-touch-icon") || | 158 (LowerCaseEqualsASCII(rel, "apple-touch-icon") || |
153 LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { | 159 LowerCaseEqualsASCII(rel, "apple-touch-icon-precomposed")))) { |
154 AddInstallIcon(elem, &app_info->icons); | 160 AddInstallIcon(elem, &app_info->icons); |
155 } | 161 } |
156 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { | 162 } else if (elem.hasHTMLTagName("meta") && elem.hasAttribute("name")) { |
157 std::string name = elem.getAttribute("name").utf8(); | 163 std::string name = elem.getAttribute("name").utf8(); |
158 WebString content = elem.getAttribute("content"); | 164 WebString content = elem.getAttribute("content"); |
159 if (name == "application-name") { | 165 if (name == "application-name") { |
160 app_info->title = content; | 166 app_info->title = content; |
161 } else if (name == "description") { | 167 } else if (name == "description") { |
(...skipping 11 matching lines...) Expand all Loading... |
173 LowerCaseEqualsASCII(content, "yes") && | 179 LowerCaseEqualsASCII(content, "yes") && |
174 app_info->mobile_capable == | 180 app_info->mobile_capable == |
175 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { | 181 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { |
176 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; | 182 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; |
177 } | 183 } |
178 } | 184 } |
179 } | 185 } |
180 } | 186 } |
181 | 187 |
182 } // namespace web_apps | 188 } // namespace web_apps |
OLD | NEW |