Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Side by Side Diff: chrome/renderer/web_apps.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/web_apps.h ('k') | chrome/renderer/worker_content_settings_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/feature_list.h" 13 #include "base/feature_list.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/common/chrome_features.h" 22 #include "chrome/common/chrome_features.h"
23 #include "chrome/common/web_application_info.h" 23 #include "chrome/common/web_application_info.h"
24 #include "third_party/WebKit/public/platform/WebIconSizesParser.h" 24 #include "third_party/WebKit/public/platform/WebIconSizesParser.h"
25 #include "third_party/WebKit/public/platform/WebString.h" 25 #include "third_party/WebKit/public/platform/WebString.h"
26 #include "third_party/WebKit/public/platform/WebURL.h" 26 #include "third_party/WebKit/public/platform/WebURL.h"
27 #include "third_party/WebKit/public/web/WebDocument.h" 27 #include "third_party/WebKit/public/web/WebDocument.h"
28 #include "third_party/WebKit/public/web/WebElement.h" 28 #include "third_party/WebKit/public/web/WebElement.h"
29 #include "third_party/WebKit/public/web/WebFrame.h" 29 #include "third_party/WebKit/public/web/WebLocalFrame.h"
30 #include "third_party/WebKit/public/web/WebNode.h" 30 #include "third_party/WebKit/public/web/WebNode.h"
31 #include "ui/gfx/geometry/size.h" 31 #include "ui/gfx/geometry/size.h"
32 #include "url/gurl.h" 32 #include "url/gurl.h"
33 33
34 using blink::WebDocument; 34 using blink::WebDocument;
35 using blink::WebElement; 35 using blink::WebElement;
36 using blink::WebFrame; 36 using blink::WebLocalFrame;
37 using blink::WebNode; 37 using blink::WebNode;
38 using blink::WebString; 38 using blink::WebString;
39 39
40 namespace web_apps { 40 namespace web_apps {
41 namespace { 41 namespace {
42 42
43 // Sizes a single size (the width or height) from a 'sizes' attribute. A size 43 // Sizes a single size (the width or height) from a 'sizes' attribute. A size
44 // matches must match the following regex: [1-9][0-9]*. 44 // matches must match the following regex: [1-9][0-9]*.
45 int ParseSingleIconSize(const base::StringPiece16& text) { 45 int ParseSingleIconSize(const base::StringPiece16& text) {
46 // Size must not start with 0, and be between 0 and 9. 46 // Size must not start with 0, and be between 0 and 9.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 sizes->push_back(size); 117 sizes->push_back(size);
118 } 118 }
119 } 119 }
120 if (*is_any && !sizes->empty()) { 120 if (*is_any && !sizes->empty()) {
121 // If is_any is true, it must occur by itself. 121 // If is_any is true, it must occur by itself.
122 return false; 122 return false;
123 } 123 }
124 return (*is_any || !sizes->empty()); 124 return (*is_any || !sizes->empty());
125 } 125 }
126 126
127 void ParseWebAppFromWebDocument(WebFrame* frame, 127 void ParseWebAppFromWebDocument(WebLocalFrame* frame,
128 WebApplicationInfo* app_info) { 128 WebApplicationInfo* app_info) {
129 WebDocument document = frame->GetDocument(); 129 WebDocument document = frame->GetDocument();
130 if (document.IsNull()) 130 if (document.IsNull())
131 return; 131 return;
132 132
133 WebElement head = document.Head(); 133 WebElement head = document.Head();
134 if (head.IsNull()) 134 if (head.IsNull())
135 return; 135 return;
136 136
137 GURL document_url = document.Url(); 137 GURL document_url = document.Url();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 base::LowerCaseEqualsASCII(content.Utf16(), "yes") && 183 base::LowerCaseEqualsASCII(content.Utf16(), "yes") &&
184 app_info->mobile_capable == 184 app_info->mobile_capable ==
185 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) { 185 WebApplicationInfo::MOBILE_CAPABLE_UNSPECIFIED) {
186 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE; 186 app_info->mobile_capable = WebApplicationInfo::MOBILE_CAPABLE_APPLE;
187 } 187 }
188 } 188 }
189 } 189 }
190 } 190 }
191 191
192 } // namespace web_apps 192 } // namespace web_apps
OLDNEW
« no previous file with comments | « chrome/renderer/web_apps.h ('k') | chrome/renderer/worker_content_settings_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698