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

Issue 4979003: Implement web app definition parsing. (Closed)

Created:
10 years, 1 month ago by Aaron Boodman
Modified:
9 years, 6 months ago
CC:
chromium-reviews, ben+cc_chromium.org, Erik does not do reviews, brettw-cc_chromium.org, pam+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Implement web app definition parsing. This required moving some code from webkit/glue to chrome/common/web_apps.cc so that it could rely on chrome/common/json_schema_validator.h. BUG=49233 TEST=Convered by unit tests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=66386

Patch Set 1 #

Patch Set 2 : cleanup #

Total comments: 35

Patch Set 3 : Respond to review #

Patch Set 4 : fix nacl64 build #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+768 lines, -300 lines) Patch
M chrome/browser/gears_integration.h View 2 chunks +5 lines, -8 lines 0 comments Download
M chrome/browser/gears_integration.cc View 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 1 2 3 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 1 2 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host_delegate.h View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.h View 1 2 4 chunks +5 lines, -6 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.cc View 1 2 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_delegate.h View 3 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/create_application_shortcut_view.cc View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/web_applications/web_app.h View 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/web_applications/web_app.cc View 4 chunks +5 lines, -7 lines 0 comments Download
M chrome/browser/web_applications/web_app_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/chrome_common.gypi View 1 2 2 chunks +3 lines, -9 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/common_param_traits.h View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/common/common_param_traits.cc View 5 chunks +7 lines, -7 lines 0 comments Download
M chrome/common/common_resources.grd View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/render_messages.cc View 2 chunks +1 line, -1 line 0 comments Download
M chrome/common/render_messages_internal.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
A chrome/common/web_app_schema.json View 1 chunk +57 lines, -0 lines 1 comment Download
A chrome/common/web_apps.h View 1 2 1 chunk +105 lines, -0 lines 0 comments Download
A chrome/common/web_apps.cc View 1 2 3 1 chunk +317 lines, -0 lines 0 comments Download
A chrome/common/web_apps_unittest.cc View 1 2 3 1 chunk +188 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.cc View 1 2 2 chunks +6 lines, -3 lines 0 comments Download
A chrome/test/data/web_app_info/full.json View 1 2 1 chunk +14 lines, -0 lines 0 comments Download
A chrome/test/data/web_app_info/invalid_icon_url.json View 1 chunk +8 lines, -0 lines 0 comments Download
A chrome/test/data/web_app_info/invalid_launch_url.json View 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/test/data/web_app_info/invalid_urls.json View 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/web_app_info/minimal.json View 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/test/data/web_app_info/missing_name.json View 1 chunk +3 lines, -0 lines 0 comments Download
M webkit/glue/dom_operations.h View 1 2 2 chunks +0 lines, -43 lines 0 comments Download
M webkit/glue/dom_operations.cc View 2 chunks +1 line, -135 lines 0 comments Download
M webkit/glue/dom_operations_unittest.cc View 1 chunk +0 lines, -54 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Aaron Boodman
The only real change here is the addition of ParseWebAppFromDefinitionFile(). The rest is just moving ...
10 years, 1 month ago (2010-11-15 00:38:56 UTC) #1
Aaron Boodman
10 years, 1 month ago (2010-11-15 00:39:19 UTC) #2
Paweł Hajdan Jr.
Drive-by with a minor test comment. No need to wait for another review by me. ...
10 years, 1 month ago (2010-11-15 08:05:31 UTC) #3
Erik does not do reviews
I didn't get through the test code yet, but thought this was useful until I ...
10 years, 1 month ago (2010-11-15 19:45:36 UTC) #4
Aaron Boodman
quick meta-repy. http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.cc File chrome/common/web_apps.cc (right): http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.cc#newcode46 chrome/common/web_apps.cc:46: return 0; On 2010/11/15 19:45:36, Erik Kay ...
10 years, 1 month ago (2010-11-15 19:52:34 UTC) #5
Aaron Boodman
On 2010/11/15 19:52:34, Aaron Boodman wrote: > They are only used in the case where ...
10 years, 1 month ago (2010-11-15 19:54:00 UTC) #6
Aaron Boodman
http://codereview.chromium.org/4979003/diff/4001/chrome/browser/extensions/convert_web_app.cc File chrome/browser/extensions/convert_web_app.cc (right): http://codereview.chromium.org/4979003/diff/4001/chrome/browser/extensions/convert_web_app.cc#newcode120 chrome/browser/extensions/convert_web_app.cc:120: // Add the permissions. In web apps, these are ...
10 years, 1 month ago (2010-11-16 03:44:44 UTC) #7
Erik does not do reviews
10 years, 1 month ago (2010-11-16 23:43:02 UTC) #8
LGTM with namespace addition

http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.cc
File chrome/common/web_apps.cc (right):

http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.cc#ne...
chrome/common/web_apps.cc:283: if (!base::StringToInt(*iter, &size) || size < 0
|| size > 128)
On 2010/11/16 03:44:45, Aaron Boodman wrote:
> On 2010/11/15 19:45:36, Erik Kay wrote:
> > 128 seems too small as a max.  512 is pretty standard as a large size (e.g.
> > apple and win7).  Also, it looks like this restriction isn't put on the link
> > rel=icon tag.
> 
> The extension system doesn't currently support any larger than 128, so I
thought
> it did not make sense to download any sizes larger than that. Do you think
that
> we should, just so that we have them for future applications..? That would
> require some other changes in extensions land.

I forgot that we had that hard-coded.  I'll file a separate bug for supporting
512 icons in the extensions system.

http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.h
File chrome/common/web_apps.h (right):

http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.h#new...
chrome/common/web_apps.h:75: gfx::Size ParseIconSize(const string16& text);
On 2010/11/16 03:44:45, Aaron Boodman wrote:
> On 2010/11/15 19:45:36, Erik Kay wrote:
> > It seems odd for all of these functions to be naked like this.  typically,
> > they'd be inside of a namespace or static inside of a class.  Can't we just
> make
> > the struct above into a class?
> 
> It is a bit odd. I moved this code from its previous home and tried to perturb
> its structure as little as possible to prevent having this change spiral out
of
> control.
> 
> Just now I tried changing it into a proper class (with getters and setters)
and
> it requires me touching a lot more code than I'd like to.
> 
> These functions used to be in the webkit_glue namespace. I could move them
into
> something like web_apps if you'd prefer.

yeah.  for now a namespace would help.

http://codereview.chromium.org/4979003/diff/4001/chrome/common/web_apps.h#new...
chrome/common/web_apps.h:88: // function returns true.
On 2010/11/16 03:44:45, Aaron Boodman wrote:
> On 2010/11/15 19:45:36, Erik Kay wrote:
> > it seems like there needs to be some way to detect this last case (no web
app
> > present) from the caller.  maybe a bool in the struct?
> 
> The current call sites don't care about that case.

OK.

http://codereview.chromium.org/4979003/diff/4001/chrome/renderer/render_view.cc
File chrome/renderer/render_view.cc (right):

http://codereview.chromium.org/4979003/diff/4001/chrome/renderer/render_view....
chrome/renderer/render_view.cc:3918:
ParseWebAppFromWebDocument(webview()->mainFrame(), &app_info, &error);
On 2010/11/16 03:44:45, Aaron Boodman wrote:
> On 2010/11/15 19:45:36, Erik Kay wrote:
> > Since this can fail, don't we need to punt if it returns false and error is
> set?
> >  Is there going to be a way to pass error up to the browser?
> 
> No, the calling code in the browser process just defaults everything that it
> doesn't find in app_info.

ok

http://codereview.chromium.org/4979003/diff/4001/chrome/test/data/web_app_inf...
File chrome/test/data/web_app_info/full.json (right):

http://codereview.chromium.org/4979003/diff/4001/chrome/test/data/web_app_inf...
chrome/test/data/web_app_info/full.json:11: // We also ignore this because it is
larger than 128.
On 2010/11/16 03:44:45, Aaron Boodman wrote:
> On 2010/11/15 19:45:36, Erik Kay wrote:
> > I thought our JSON parser barfed on comments
> 
> The one in v8 does (as per the spec), but the one that we wrote (in base/json)
> accepts them, which I think is quite nice.

agree.  that always bugged me about the JSON spec.

http://codereview.chromium.org/4979003/diff/28001/chrome/common/web_app_schem...
File chrome/common/web_app_schema.json (right):

http://codereview.chromium.org/4979003/diff/28001/chrome/common/web_app_schem...
chrome/common/web_app_schema.json:44: "type": "string"
minLength: 1 here too?

Powered by Google App Engine
This is Rietveld 408576698