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

Issue 225009: Implementing chrome.i18n.getMessage call, that loads message from the extensi... (Closed)

Created:
11 years, 3 months ago by Nebojša Ćirić
Modified:
11 years, 3 months ago
CC:
chromium-reviews_googlegroups.com, jam, pam+watch_chromium.org, Paweł Hajdan Jr., darin (slow to review), brettw, Ben Goodger (Google), tim (not reviewing)
Visibility:
Public.

Description

Implementing chrome.i18n.getMessage call, that loads message from the extension catalog, and if necessary replaces placeholders (up to 9). I have 3 forms of getMessage call: getMessage("name") for simple messages without placeholders. getMessage("name", "one param") for messages with only one placeholder. getMessage("name", ["one", "two"]) for messages with only one or more placeholders. getMessage returns string. BUG=12131 TEST=Load samples/i18n extension (switch Chrome to sr locale) and observe ext. name, description and toolstrip texts should be in Serbian.

Patch Set 1 #

Total comments: 4

Patch Set 2 : '' #

Total comments: 4

Patch Set 3 : '' #

Total comments: 2

Patch Set 4 : '' #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+510 lines, -686 lines) Patch
M chrome/browser/extensions/extension_l10n_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_message_bundle.h View 2 3 1 chunk +0 lines, -110 lines 0 comments Download
M chrome/browser/extensions/extension_message_bundle.cc View 2 3 1 chunk +0 lines, -256 lines 0 comments Download
D chrome/browser/extensions/extension_message_bundle_unittest.cc View 1 chunk +0 lines, -288 lines 0 comments Download
M chrome/browser/extensions/extension_process_manager.cc View 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 4 chunks +3 lines, -3 lines 0 comments Download
M chrome/common/extensions/api/extension_api.json View 1 1 chunk +29 lines, -2 lines 0 comments Download
M chrome/common/extensions/docs/i18n.html View 1 5 chunks +189 lines, -3 lines 0 comments Download
M chrome/common/extensions/docs/static/i18n.html View 1 2 chunks +15 lines, -1 line 0 comments Download
M chrome/common/extensions/extension.h View 1 chunk +1 line, -1 line 0 comments Download
A + chrome/common/extensions/extension_message_bundle.h View 4 chunks +12 lines, -5 lines 0 comments Download
A + chrome/common/extensions/extension_message_bundle.cc View 2 chunks +9 lines, -3 lines 0 comments Download
A + chrome/common/extensions/extension_message_bundle_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/render_messages_internal.h View 3 chunks +12 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/extension_api_client_unittest.cc View 1 1 chunk +18 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.cc View 2 3 9 chunks +80 lines, -2 lines 4 comments Download
M chrome/renderer/render_thread.h View 2 3 1 chunk +9 lines, -4 lines 0 comments Download
M chrome/renderer/render_thread.cc View 2 3 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/renderer/resources/extension_process_bindings.js View 2 chunks +6 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/i18n/_locales/en_US/messages.json View 1 chunk +30 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/api_test/i18n/manifest.json View 1 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/i18n/test.js View 1 2 3 2 chunks +15 lines, -2 lines 0 comments Download
A chrome/test/data/extensions/samples/i18n/_locales/en_US/messages.json View 1 chunk +24 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/i18n/_locales/sr/messages.json View 1 2 3 1 chunk +24 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/samples/i18n/manifest.json View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/test/data/extensions/samples/i18n/toolstrip.html View 1 1 chunk +9 lines, -3 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Nebojša Ćirić
11 years, 3 months ago (2009-09-23 16:45:26 UTC) #1
jungshik at Google
It'd be nice if an extension with a non-trivial use of these APIs can be ...
11 years, 3 months ago (2009-09-23 18:50:47 UTC) #2
Nebojša Ćirić
http://codereview.chromium.org/225009/diff/1/12 File chrome/common/extensions/docs/static/i18n.html (right): http://codereview.chromium.org/225009/diff/1/12#newcode29 Line 29: arg2. I think that API docs have a ...
11 years, 3 months ago (2009-09-23 19:44:46 UTC) #3
Erik does not do reviews
Apologies in advance, but I think this needs to be rethought a bit. While almost ...
11 years, 3 months ago (2009-09-24 01:08:34 UTC) #4
Nebojša Ćirić
No need to apologize, since that was how I wanted to do it in the ...
11 years, 3 months ago (2009-09-24 15:43:27 UTC) #5
Nebojša Ćirić
Before I do anything let me just make sure I have correct idea: 1. Extension ...
11 years, 3 months ago (2009-09-24 18:29:35 UTC) #6
Erik does not do reviews
On Thu, Sep 24, 2009 at 11:29 AM, <cira@chromium.org> wrote: > Before I do anything ...
11 years, 3 months ago (2009-09-24 20:27:33 UTC) #7
Nebojša Ćirić
Ready for next pass. Testing is somewhat harder to get right with JS methods that ...
11 years, 3 months ago (2009-09-25 21:22:27 UTC) #8
Erik does not do reviews
http://codereview.chromium.org/225009/diff/9001/9014 File chrome/browser/extensions/extension_process_manager.cc (right): http://codereview.chromium.org/225009/diff/9001/9014#newcode118 Line 118: // Send l10n messages to the renderer. nit: ...
11 years, 3 months ago (2009-09-25 23:16:06 UTC) #9
Nebojša Ćirić
All done. On 2009/09/25 23:16:06, Erik Kay wrote: > http://codereview.chromium.org/225009/diff/9001/9014 > File chrome/browser/extensions/extension_process_manager.cc (right): > ...
11 years, 3 months ago (2009-09-26 00:12:09 UTC) #10
Erik does not do reviews
LGTM with these changes http://codereview.chromium.org/225009/diff/15009/15025 File chrome/renderer/extensions/extension_process_bindings.cc (right): http://codereview.chromium.org/225009/diff/15009/15025#newcode289 Line 289: if (args.Length() != 2 ...
11 years, 3 months ago (2009-09-26 00:35:48 UTC) #11
Nebojša Ćirić
> > http://codereview.chromium.org/225009/diff/15009/15025#newcode312 > Line 312: v8::Array* placeholders = static_cast<v8::Array*>(*args[1]); > verify that the length ...
11 years, 2 months ago (2009-09-26 18:56:09 UTC) #12
Erik does not do reviews
11 years, 2 months ago (2009-09-26 19:26:50 UTC) #13
On Sat, Sep 26, 2009 at 11:55 AM, Neboj=C5=A1a =C4=86iri=C4=87 <cira@chromi=
um.org> wrote:
>> http://codereview.chromium.org/225009/diff/15009/15025#newcode312
>> Line 312: v8::Array* placeholders =3D static_cast<v8::Array*>(*args[1]);
>> verify that the length of placeholders is > 0 and <=3D 9 and add a DCHEC=
K
>>
> extension_api.json already checks for min 1 and max 9 for this parameter.
> =C2=A0Do you still want me to add this check?
> Cira

Yes.  Defense in depth is a good thing, particularly when we're
dealing with untrusted code.

Erik

Powered by Google App Engine
This is Rietveld 408576698