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

Issue 1168383002: Implement sidebar support for extension action popups

Created:
5 years, 6 months ago by ltilve
Modified:
5 years, 2 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org, ben6
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement sidebar support for extension action popups This is an initial patch that provides the non-UI code to allow extensions to show contents on a sidebar as an alternative to the popup. BUG=477424

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 3

Patch Set 4 : Add sidebar handling logic and browser_tests #

Total comments: 6

Patch Set 5 : #

Total comments: 88

Patch Set 6 : #

Patch Set 7 : #

Total comments: 20

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Total comments: 12

Patch Set 11 : #

Patch Set 12 : Rebased patch set to current master #

Patch Set 13 : Fix assertion failure at extension_view_host.cc #

Unified diffs Side-by-side diffs Delta from patch set Stats (+372 lines, -47 lines) Patch
M chrome/browser/extensions/api/developer_private/inspectable_views_finder.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/extensions/chrome_extensions_browser_client.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/extension_action.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_action.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/extension_view_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/extension_view_host_factory.h View 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_view_host_factory.cc View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/browser/extensions/sidebar_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +141 lines, -0 lines 0 comments Download
M chrome/browser/ui/extensions/extension_action_view_controller.h View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +22 lines, -0 lines 0 comments Download
M chrome/browser/ui/extensions/extension_action_view_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +114 lines, -40 lines 0 comments Download
M chrome/browser/ui/toolbar/toolbar_action_view_controller.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/ui/toolbar/toolbar_actions_bar.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/ui/toolbar/toolbar_actions_bar.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +16 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/api/developer_private.idl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/api/extension_action/action_info.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/api/extension_action/action_info.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -2 lines 0 comments Download
A chrome/test/data/extensions/sidebar/manifest.json View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/sidebar/simple_page.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -2 lines 0 comments Download
A chrome/test/data/extensions/sidebar2/manifest.json View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
M extensions/browser/extension_host.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -2 lines 0 comments Download
M extensions/browser/process_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M extensions/common/manifest_constants.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M extensions/common/manifest_constants.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M extensions/common/view_type.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 21 (1 generated)
ltilve
Adds the first part for the implementation to allow extensions to show contents on a ...
5 years, 6 months ago (2015-06-09 09:45:40 UTC) #2
Devlin
You seem to have omitted all the code that makes this do anything. ;) When ...
5 years, 6 months ago (2015-06-10 17:25:05 UTC) #3
ltilve
Thanks for the comments. I have merged now also the changes to handle all the ...
5 years, 6 months ago (2015-06-11 18:14:14 UTC) #4
Devlin
You should also include the logic from ExtensionActionViewController, since that class is platform-agnostic, and does ...
5 years, 6 months ago (2015-06-16 17:56:12 UTC) #5
ltilve
> You should also include the logic from ExtensionActionViewController, since that > class is platform-agnostic, ...
5 years, 6 months ago (2015-06-19 12:07:25 UTC) #6
Devlin
Okay, now that the structure is out of the way, on to the easier fixes. ...
5 years, 6 months ago (2015-06-19 19:56:11 UTC) #7
ltilve
https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/extension_system_impl.cc File chrome/browser/extensions/extension_system_impl.cc (right): https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/extension_system_impl.cc#newcode575 chrome/browser/extensions/extension_system_impl.cc:575: void ExtensionSystemImpl::CreateSidebarManager() { On 2015/06/19 19:56:08, Devlin wrote: > ...
5 years, 5 months ago (2015-06-28 22:44:21 UTC) #8
ltilve
https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_manager.h File chrome/browser/extensions/sidebar_manager.h (right): https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_manager.h#newcode38 chrome/browser/extensions/sidebar_manager.h:38: // Returns SidebarContainer registered for |tab| or nullptr if ...
5 years, 5 months ago (2015-06-29 10:46:51 UTC) #9
ltilve
On 2015/06/19 19:56:11, Devlin wrote: > Okay, now that the structure is out of the ...
5 years, 5 months ago (2015-07-07 21:10:52 UTC) #10
Devlin
https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc File chrome/browser/extensions/sidebar_browsertest.cc (right): https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc#newcode34 chrome/browser/extensions/sidebar_browsertest.cc:34: class SidebarTest : public ExtensionBrowserTest { On 2015/06/28 22:44:19, ...
5 years, 5 months ago (2015-07-07 21:39:30 UTC) #11
ltilve
Thanks for the reviews. Please do not hesitate in asking for any further clarification about ...
5 years, 5 months ago (2015-07-09 22:15:50 UTC) #12
Devlin
https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc File chrome/browser/extensions/sidebar_browsertest.cc (right): https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc#newcode34 chrome/browser/extensions/sidebar_browsertest.cc:34: class SidebarTest : public ExtensionBrowserTest { On 2015/07/09 22:15:50, ...
5 years, 5 months ago (2015-07-10 20:18:42 UTC) #13
ltilve
Thanks for the review. https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc File chrome/browser/extensions/sidebar_browsertest.cc (right): https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc#newcode34 chrome/browser/extensions/sidebar_browsertest.cc:34: class SidebarTest : public ExtensionBrowserTest ...
5 years, 5 months ago (2015-07-17 16:26:23 UTC) #14
benjamin.j.mccann
On 2015/07/17 16:26:23, ltilve wrote: > Thanks for the review. > > https://codereview.chromium.org/1168383002/diff/80001/chrome/browser/extensions/sidebar_browsertest.cc > File ...
5 years, 5 months ago (2015-07-22 20:13:36 UTC) #15
Devlin
Hey Ben, I've been holding off on this until we finish reworking the doc, since ...
5 years, 5 months ago (2015-07-22 20:16:36 UTC) #16
ltilve
Hi Devlin, thanks for your comments. It seems that everyone was fine with the per-window ...
5 years, 4 months ago (2015-07-27 18:58:20 UTC) #17
Devlin
On 2015/07/27 18:58:20, ltilve wrote: > Hi Devlin, thanks for your comments. It seems that ...
5 years, 4 months ago (2015-07-28 22:59:02 UTC) #18
benjamin.j.mccann
> I'd still really like to see the doc updated to reflect this. Going forward, ...
5 years, 4 months ago (2015-07-28 23:10:08 UTC) #19
Devlin
https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensions/sidebar_browsertest.cc File chrome/browser/extensions/sidebar_browsertest.cc (right): https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensions/sidebar_browsertest.cc#newcode29 chrome/browser/extensions/sidebar_browsertest.cc:29: class SidebarTest : public ExtensionBrowserTest { Why does this ...
5 years, 4 months ago (2015-07-30 17:56:46 UTC) #20
ltilve
5 years, 4 months ago (2015-08-07 16:15:02 UTC) #21
Thanks for the reviews and sorry in advance if we were not understanding
correctly any of your comments :)

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensi...
File chrome/browser/extensions/sidebar_browsertest.cc (right):

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensi...
chrome/browser/extensions/sidebar_browsertest.cc:29: class SidebarTest : public
ExtensionBrowserTest {
On 2015/07/30 17:56:46, Devlin wrote:
> Why does this need to be a browser test?

We have been earlier following the suggestion of testing opening and closing
sidebars through SidebarManager API with unittests. Now we don't have any more a
SidebarManager to be able to force creation of sidebars, and testing inside
unittests any popup/sidebar logic seems to be failing because at
ExtensionActionViewController::ExecuteAction the ExtensionAction::ACTION_NONE
type is returned due to null web_contents.

For those reasons we are thinking that we need it to be a browser test. Maybe we
are not properly setting anything for it, please let us know if we are wrong
about this.

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensi...
chrome/browser/extensions/sidebar_browsertest.cc:103:
IN_PROC_BROWSER_TEST_F(SidebarTest, CreateDisabledSidebar) {
On 2015/07/30 17:56:46, Devlin wrote:
> What about testing multiple extensions with sidebars?

Done.

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensi...
File chrome/browser/extensions/sidebar_container.cc (right):

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/extensi...
chrome/browser/extensions/sidebar_container.cc:1: // Copyright 2015 The Chromium
Authors. All rights reserved.
On 2015/07/30 17:56:46, Devlin wrote:
> Umm... this class doesn't do anything other than initialize the host.  Why do
we
> need it?

Done. We have refactored out sidebarContainer now.

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/ui/exte...
File chrome/browser/ui/extensions/extension_action_view_controller.cc (right):

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/ui/exte...
chrome/browser/ui/extensions/extension_action_view_controller.cc:222: return
GetPreferredPopupViewController()->TriggerSidebarWithUrl(
On 2015/07/30 17:56:46, Devlin wrote:
> The fact that so much of this code seems to be copy-pasted with
s/popup/sidebar
> suggests it could be factored better...

We need to handle a case which opens a popup when a sidebar is already shown.
For this case, we were thinking that maybe is more clear having separate methods
for sidebar and popups.

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/ui/exte...
chrome/browser/ui/extensions/extension_action_view_controller.cc:355:
PressButtonWithSlideOutIfEnabled(
On 2015/07/30 17:56:46, Devlin wrote:
> Wait, what?  This calls into PressButtonWithSlideOutIfEnabled, but that method
> ignores the case of the sidebar.  This means that if you enable the extension
> action redesign, |closure| will never be run.

Fixed. You were totally right, good catch.

https://codereview.chromium.org/1168383002/diff/180001/chrome/browser/ui/exte...
chrome/browser/ui/extensions/extension_action_view_controller.cc:388: // In the
traditional toolbar, page actions only know how to close their own
On 2015/07/30 17:56:46, Devlin wrote:
> Obviously from copy paste (another reason not to do it), but this won't work
> here.  A page action will need to close another sidebar, too.

Done. Because the sidebar extension is only instantiated using browser action,
we modified it to handle page action as a error.
Also, toolbar_actions_bar is null only if this is a page action without
the toolbar redesigned turned on, so we handle it as a error in the sidebar
case.

Powered by Google App Engine
This is Rietveld 408576698