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/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 std::string content_str; | 218 std::string content_str; |
219 | 219 |
220 // Search for the "mobile-web-app-capable" tag. | 220 // Search for the "mobile-web-app-capable" tag. |
221 bool mobile_parse_success = RetrieveMetaTagContent( | 221 bool mobile_parse_success = RetrieveMetaTagContent( |
222 main_frame, | 222 main_frame, |
223 expected_url, | 223 expected_url, |
224 "mobile-web-app-capable", | 224 "mobile-web-app-capable", |
225 &found_tag, | 225 &found_tag, |
226 &content_str); | 226 &content_str); |
227 bool is_mobile_webapp_capable = mobile_parse_success && found_tag && | 227 bool is_mobile_webapp_capable = mobile_parse_success && found_tag && |
228 base::LowerCaseEqualsASCII(content_str, "yes"); | 228 LowerCaseEqualsASCII(content_str, "yes"); |
229 | 229 |
230 // Search for the "apple-mobile-web-app-capable" tag. | 230 // Search for the "apple-mobile-web-app-capable" tag. |
231 bool apple_parse_success = RetrieveMetaTagContent( | 231 bool apple_parse_success = RetrieveMetaTagContent( |
232 main_frame, | 232 main_frame, |
233 expected_url, | 233 expected_url, |
234 "apple-mobile-web-app-capable", | 234 "apple-mobile-web-app-capable", |
235 &found_tag, | 235 &found_tag, |
236 &content_str); | 236 &content_str); |
237 bool is_apple_mobile_webapp_capable = apple_parse_success && found_tag && | 237 bool is_apple_mobile_webapp_capable = apple_parse_success && found_tag && |
238 base::LowerCaseEqualsASCII(content_str, "yes"); | 238 LowerCaseEqualsASCII(content_str, "yes"); |
239 | 239 |
240 bool is_only_apple_mobile_webapp_capable = | 240 bool is_only_apple_mobile_webapp_capable = |
241 is_apple_mobile_webapp_capable && !is_mobile_webapp_capable; | 241 is_apple_mobile_webapp_capable && !is_mobile_webapp_capable; |
242 if (main_frame && is_only_apple_mobile_webapp_capable) { | 242 if (main_frame && is_only_apple_mobile_webapp_capable) { |
243 blink::WebConsoleMessage message( | 243 blink::WebConsoleMessage message( |
244 blink::WebConsoleMessage::LevelWarning, | 244 blink::WebConsoleMessage::LevelWarning, |
245 "<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is " | 245 "<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is " |
246 "deprecated. Please include <meta name=\"mobile-web-app-capable\" " | 246 "deprecated. Please include <meta name=\"mobile-web-app-capable\" " |
247 "content=\"yes\"> - " | 247 "content=\"yes\"> - " |
248 "http://developers.google.com/chrome/mobile/docs/installtohomescreen"); | 248 "http://developers.google.com/chrome/mobile/docs/installtohomescreen"); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 WebNodeList children = head.childNodes(); | 464 WebNodeList children = head.childNodes(); |
465 for (size_t i = 0; i < children.length(); ++i) { | 465 for (size_t i = 0; i < children.length(); ++i) { |
466 WebNode node = children.item(i); | 466 WebNode node = children.item(i); |
467 if (!node.isElementNode()) | 467 if (!node.isElementNode()) |
468 continue; | 468 continue; |
469 WebElement element = node.to<WebElement>(); | 469 WebElement element = node.to<WebElement>(); |
470 if (!element.hasHTMLTagName(tag_name)) | 470 if (!element.hasHTMLTagName(tag_name)) |
471 continue; | 471 continue; |
472 WebString value = element.getAttribute(attribute_name); | 472 WebString value = element.getAttribute(attribute_name); |
473 if (value.isNull() || | 473 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
474 !base::LowerCaseEqualsASCII(base::string16(value), "refresh")) | |
475 continue; | 474 continue; |
476 return true; | 475 return true; |
477 } | 476 } |
478 return false; | 477 return false; |
479 } | 478 } |
OLD | NEW |