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

Issue 173556: Implement script API:executeScript (Closed)

Created:
11 years, 3 months ago by tangjie
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, Erik does not do reviews, jam, Ben Goodger (Google), darin (slow to review), brettw, Pam (message me for reviews)
Visibility:
Public.

Description

programmatically inject scripts from an extension. BUG=12465

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 34

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 11

Patch Set 12 : '' #

Patch Set 13 : '' #

Patch Set 14 : '' #

Patch Set 15 : '' #

Total comments: 27

Patch Set 16 : '' #

Patch Set 17 : '' #

Patch Set 18 : '' #

Patch Set 19 : '' #

Patch Set 20 : '' #

Total comments: 37

Patch Set 21 : '' #

Patch Set 22 : '' #

Patch Set 23 : '' #

Patch Set 24 : '' #

Total comments: 29

Patch Set 25 : '' #

Patch Set 26 : '' #

Total comments: 8

Patch Set 27 : '' #

Patch Set 28 : '' #

Patch Set 29 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+583 lines, -8 lines) Patch
A chrome/browser/extensions/execute_code_in_tab_function.h View 21 22 23 24 25 26 1 chunk +52 lines, -0 lines 0 comments Download
A chrome/browser/extensions/execute_code_in_tab_function.cc View 21 22 23 24 25 26 1 chunk +156 lines, -0 lines 0 comments Download
A chrome/browser/extensions/execute_script_apitest.cc View 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 3 chunks +17 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module_constants.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module_constants.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.cc View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 18 19 20 21 22 23 24 25 26 27 28 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/extension_api.json View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +58 lines, -0 lines 0 comments Download
M chrome/common/notification_type.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/render_messages_internal.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 3 chunks +14 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 3 chunks +30 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.cc View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 4 chunks +40 lines, -0 lines 0 comments Download
M chrome/renderer/user_script_slave.h View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 3 chunks +6 lines, -0 lines 0 comments Download
M chrome/renderer/user_script_slave.cc View 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 3 chunks +10 lines, -5 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/1.css View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/manifest.json View 25 1 chunk +7 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/script1.js View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/script2.js View 1 chunk +19 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/script3.js View 1 chunk +19 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/test.html View 25 26 27 1 chunk +86 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/executescript/test_executescript.html View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
tangjie
Hi Aaron, Erik and Matt, Please help review this path. Thanks! Jerry
11 years, 3 months ago (2009-09-03 10:28:07 UTC) #1
Matt Perry
Here's some initial feedback. I'll add more after lunch. Mark the bug number in your ...
11 years, 3 months ago (2009-09-03 18:52:05 UTC) #2
Erik does not do reviews
I'll defer to Aaron and Matt here unless there's something specific you'd like me to ...
11 years, 3 months ago (2009-09-03 19:01:03 UTC) #3
Matt Perry
some more comments http://codereview.chromium.org/173556/diff/13001/14017 File chrome/common/render_messages_internal.h (right): http://codereview.chromium.org/173556/diff/13001/14017#newcode230 Line 230: bool /* whether the script ...
11 years, 3 months ago (2009-09-03 21:54:07 UTC) #4
tangjie
http://codereview.chromium.org/173556/diff/13001/14028 File chrome/browser/extensions/extension_browsertests_misc.cc (right): http://codereview.chromium.org/173556/diff/13001/14028#newcode130 Line 130: AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"). On 2009/09/03 18:52:05, Matt Perry wrote: > ...
11 years, 3 months ago (2009-09-04 17:57:00 UTC) #5
tangjie
Hi Aaron and Matt, Could you please help review this patch in next round? Thanks! ...
11 years, 3 months ago (2009-09-08 02:11:38 UTC) #6
Aaron Boodman
http://codereview.chromium.org/173556/diff/19001/10003 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/173556/diff/19001/10003#newcode835 Line 835: &error_)) { Nit: indent "&error" under "execute_tab_id_". http://codereview.chromium.org/173556/diff/19001/10003#newcode843 ...
11 years, 3 months ago (2009-09-08 08:21:47 UTC) #7
tangjie
http://codereview.chromium.org/173556/diff/19001/10003 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/173556/diff/19001/10003#newcode855 Line 855: if (!extension->LoadUserScriptHelper(script_info, 0, false, &error, Why I try ...
11 years, 3 months ago (2009-09-08 09:51:38 UTC) #8
Aaron Boodman
On Tue, Sep 8, 2009 at 2:51 AM, <tangjie@google.com> wrote: > > http://codereview.chromium.org/173556/diff/19001/10003 > File ...
11 years, 3 months ago (2009-09-08 10:35:29 UTC) #9
tangjie
http://codereview.chromium.org/173556/diff/19001/10003 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/173556/diff/19001/10003#newcode835 Line 835: &error_)) { On 2009/09/08 08:21:47, Aaron Boodman wrote: ...
11 years, 3 months ago (2009-09-10 17:32:23 UTC) #10
Aaron Boodman
Some high level comments: ================================================= After seeing the implementation, I'd like to change this API ...
11 years, 3 months ago (2009-09-11 00:29:28 UTC) #11
tangjie
http://codereview.chromium.org/173556/diff/11143/11144 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/173556/diff/11143/11144#newcode840 Line 840: bool ExecuteFunction::RunImpl() { I changed my code to ...
11 years, 3 months ago (2009-09-14 13:27:54 UTC) #12
Matt Perry
http://codereview.chromium.org/173556/diff/11143/11160 File chrome/browser/extensions/extension_browsertests_misc.cc (right): http://codereview.chromium.org/173556/diff/11143/11160#newcode135 Line 135: // hosting toolstrip1.html. nit: toolstrip.html http://codereview.chromium.org/173556/diff/13048/13074 File chrome/browser/extensions/extension_execute_function.cc ...
11 years, 3 months ago (2009-09-14 19:11:38 UTC) #13
Aaron Boodman
Getting closer! Thanks for your patience! http://codereview.chromium.org/173556/diff/13048/13074 File chrome/browser/extensions/extension_execute_function.cc (right): http://codereview.chromium.org/173556/diff/13048/13074#newcode35 Line 35: if (!browser ...
11 years, 3 months ago (2009-09-15 05:07:27 UTC) #14
tangjie
http://codereview.chromium.org/173556/diff/13048/13074 File chrome/browser/extensions/extension_execute_function.cc (right): http://codereview.chromium.org/173556/diff/13048/13074#newcode35 Line 35: if (!browser || On 2009/09/15 05:07:27, Aaron Boodman ...
11 years, 3 months ago (2009-09-15 18:16:34 UTC) #15
Aaron Boodman
http://codereview.chromium.org/173556/diff/18073/24097 File chrome/browser/extensions/execute_code_in_tab_function.cc (right): http://codereview.chromium.org/173556/diff/18073/24097#newcode45 Line 45: if (!tab_value) Nit: you don't need to check ...
11 years, 3 months ago (2009-09-15 19:17:26 UTC) #16
Matt Perry
http://codereview.chromium.org/173556/diff/18073/24097 File chrome/browser/extensions/execute_code_in_tab_function.cc (right): http://codereview.chromium.org/173556/diff/18073/24097#newcode144 Line 144: Source<void>(reinterpret_cast<void*>(request_id()))); On 2009/09/15 19:17:27, Aaron Boodman wrote: > ...
11 years, 3 months ago (2009-09-15 19:38:09 UTC) #17
Matt Perry
Almost there. http://codereview.chromium.org/173556/diff/18073/24097 File chrome/browser/extensions/execute_code_in_tab_function.cc (right): http://codereview.chromium.org/173556/diff/18073/24097#newcode146 Line 146: contents->ExecuteCode(request_id(), extension_id(), notification_type_, it feels wrong ...
11 years, 3 months ago (2009-09-15 21:07:32 UTC) #18
tangjie
http://codereview.chromium.org/173556/diff/18073/24097 File chrome/browser/extensions/execute_code_in_tab_function.cc (right): http://codereview.chromium.org/173556/diff/18073/24097#newcode45 Line 45: if (!tab_value) On 2009/09/15 19:17:27, Aaron Boodman wrote: ...
11 years, 3 months ago (2009-09-16 15:17:34 UTC) #19
Aaron Boodman
LGTM with some last nits. *phew*! http://codereview.chromium.org/173556/diff/20087/20106 File chrome/browser/extensions/execute_code_in_tab_function.cc (right): http://codereview.chromium.org/173556/diff/20087/20106#newcode103 Line 103: LOG(WARNING) << ...
11 years, 3 months ago (2009-09-16 18:43:34 UTC) #20
Matt Perry
LGTM!
11 years, 3 months ago (2009-09-16 20:26:06 UTC) #21
tangjie
11 years, 3 months ago (2009-09-17 06:45:19 UTC) #22
http://codereview.chromium.org/173556/diff/20087/20106
File chrome/browser/extensions/execute_code_in_tab_function.cc (right):

http://codereview.chromium.org/173556/diff/20087/20106#newcode103
Line 103: LOG(WARNING) << "Failed to load user script file: "
On 2009/09/16 18:43:34, Aaron Boodman wrote:
> This message should be put in error_ instead of logged out, so that developers
> receive it. (see comment about SendResponse(false) below).

Done.

http://codereview.chromium.org/173556/diff/20087/20106#newcode117
Line 117: result_.reset(Value::CreateBooleanValue(false));
On 2009/09/16 18:43:34, Aaron Boodman wrote:
> The success callback shouldn't take a boolean param, it should take no params.
> Failure should be indicated by using our built in failure mechanism that all
> extension functions share.
> 
> So I think that ReportError() can go, and you can change the code in
LoadFile()
> to do ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
> &ExecuteCodeInTabFunction::SendResponse, false));
> 
> Then remove all the code that sets the result_ member.

Done.

http://codereview.chromium.org/173556/diff/20087/20106#newcode124
Line 124: if (ExtensionTabUtil::GetTabById(execute_tab_id_, profile(), &browser,
NULL,
On 2009/09/16 18:43:34, Aaron Boodman wrote:
> Reverse this check and return early.

Done.

http://codereview.chromium.org/173556/diff/20087/20110
File chrome/test/data/extensions/api_test/executescript/test.html (right):

http://codereview.chromium.org/173556/diff/20087/20110#newcode7
Line 7: var relativePath =
'/files/extensions/api_test/executescript/test_executescript.html';
On 2009/09/16 18:43:34, Aaron Boodman wrote:
> 80 cols

Done.

Powered by Google App Engine
This is Rietveld 408576698