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

Issue 5064001: More changes to extension omnibox API for styles. (Closed)

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

Description

More changes to extension omnibox API for styles. - Overlapping styles are now bitwise-ORed together (instead of replacing previous ones). - The "length" parameter for style ranges is optional and can be 0. BUG=63077, 63078 TEST=covered by tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=66327

Patch Set 1 #

Total comments: 4

Patch Set 2 : offset #

Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -109 lines) Patch
M chrome/browser/extensions/extension_omnibox_api.h View 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/extensions/extension_omnibox_api.cc View 1 3 chunks +17 lines, -48 lines 0 comments Download
M chrome/browser/extensions/extension_omnibox_apitest.cc View 1 chunk +13 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_omnibox_unittest.cc View 7 chunks +24 lines, -35 lines 0 comments Download
M chrome/common/extensions/api/extension_api.json View 1 2 chunks +8 lines, -8 lines 0 comments Download
M chrome/common/extensions/docs/experimental.omnibox.html View 7 chunks +10 lines, -10 lines 0 comments Download
M chrome/test/data/extensions/api_test/omnibox/test.html View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
Matt Perry
10 years, 1 month ago (2010-11-16 01:20:00 UTC) #1
asargent_no_longer_on_chrome
lgtm http://codereview.chromium.org/5064001/diff/1/chrome/browser/extensions/extension_omnibox_api.cc File chrome/browser/extensions/extension_omnibox_api.cc (right): http://codereview.chromium.org/5064001/diff/1/chrome/browser/extensions/extension_omnibox_api.cc#newcode146 chrome/browser/extensions/extension_omnibox_api.cc:146: if (!style->GetInteger(kDescriptionStylesLength, &length) || length < 0) It ...
10 years, 1 month ago (2010-11-16 19:05:02 UTC) #2
Matt Perry
10 years, 1 month ago (2010-11-16 22:26:44 UTC) #3
http://codereview.chromium.org/5064001/diff/1/chrome/browser/extensions/exten...
File chrome/browser/extensions/extension_omnibox_api.cc (right):

http://codereview.chromium.org/5064001/diff/1/chrome/browser/extensions/exten...
chrome/browser/extensions/extension_omnibox_api.cc:146: if
(!style->GetInteger(kDescriptionStylesLength, &length) || length < 0)
On 2010/11/16 19:05:02, Antony Sargent wrote:
> It seems like passing a negative length value is likely to indicate a bug in
the
> calling extension's arithmetic. Would it make more sense to either return an
> error or just ignore this style (ie treat it the same as length 0)? Your call.

The negative checks here are just me being paranoid - the JSON schema should
prohibit negative values in the extension process.

If GetInteger fails, that means that length was omitted, which means "to the end
of the range".

> On a related note, it might actually be useful to be able to send negative
> values for the *offset* - in python I find it's often convenient to use
negative
> indices on strings and arrays to do things like "give me the last element in
> this array" or "give me the last 5 characters from this string". 

That's a good idea. Using python-style ranges would probably be fairly intuitive
for developers.

http://codereview.chromium.org/5064001/diff/1/chrome/common/extensions/api/ex...
File chrome/common/extensions/api/extension_api.json (right):

http://codereview.chromium.org/5064001/diff/1/chrome/common/extensions/api/ex...
chrome/common/extensions/api/extension_api.json:3931: "description": "An array
of style objects, created using styleUrl, styleMatch, or styleDim. A style
applies to the region of text specified by the style's starting offset and
length. If there are any overlapping regions of text covered by multiple styles,
they will be added together (e.g. 'match' + 'dim' will display a dimmed match).
Not all style combinations will be visually distinct.",
On 2010/11/16 19:05:02, Antony Sargent wrote:
> nit: I'm not quite sure what you mean by "Not all style combinations will be
> visually distinct" - perhaps an example would illuminate?

Done.

Powered by Google App Engine
This is Rietveld 408576698