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

Issue 1315723003: Make WebUIImpl a WebContentsObserver to re-use RenderViewCreated() (Closed)

Created:
5 years, 3 months ago by Dan Beam
Modified:
5 years, 3 months ago
Reviewers:
Charlie Reis
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, creis+watch_chromium.org, darin-cc_chromium.org, nasko
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make WebUIImpl a WebContentsObserver to re-use RenderViewCreated() Reduces the amount of code in WebContentsImpl by re-using this class. RenderViewCreated is dispatched right after the custom method is called. R=creis@chromium.org BUG=516690

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -21 lines) Patch
M content/browser/web_contents/web_contents_impl.cc View 1 chunk +0 lines, -12 lines 1 comment Download
M content/browser/webui/web_ui_impl.h View 2 chunks +4 lines, -8 lines 3 comments Download
M content/browser/webui/web_ui_impl.cc View 1 chunk +2 lines, -1 line 1 comment Download

Messages

Total messages: 9 (0 generated)
Dan Beam
https://codereview.chromium.org/1315723003/diff/1/content/browser/webui/web_ui_impl.h File content/browser/webui/web_ui_impl.h (right): https://codereview.chromium.org/1315723003/diff/1/content/browser/webui/web_ui_impl.h#newcode104 content/browser/webui/web_ui_impl.h:104: WebContents* web_contents_; NOTE: I attempted to use WebContentsObserver::web_contents() and ...
5 years, 3 months ago (2015-08-28 01:50:53 UTC) #1
Charlie Reis
Yes, this seems like a better approach that decouples the WebUI code from WebContentsImpl a ...
5 years, 3 months ago (2015-08-28 17:05:56 UTC) #2
Dan Beam
https://codereview.chromium.org/1315723003/diff/1/content/browser/webui/web_ui_impl.h File content/browser/webui/web_ui_impl.h (right): https://codereview.chromium.org/1315723003/diff/1/content/browser/webui/web_ui_impl.h#newcode104 content/browser/webui/web_ui_impl.h:104: WebContents* web_contents_; On 2015/08/28 17:05:56, Charlie Reis wrote: > ...
5 years, 3 months ago (2015-08-28 17:13:16 UTC) #3
Dan Beam
I think if WebUIs were owned by a RFH instead of RFHM, it'd fix some ...
5 years, 3 months ago (2015-08-29 01:26:47 UTC) #4
Charlie Reis
[+nasko to CC] On 2015/08/29 01:26:47, Dan Beam wrote: > I think if WebUIs were ...
5 years, 3 months ago (2015-08-31 19:07:18 UTC) #5
Dan Beam
On 2015/08/31 19:07:18, Charlie Reis wrote: > [+nasko to CC] > > On 2015/08/29 01:26:47, ...
5 years, 3 months ago (2015-09-01 15:31:37 UTC) #6
Charlie Reis
On 2015/09/01 15:31:37, Dan Beam wrote: > On 2015/08/31 19:07:18, Charlie Reis wrote: > > ...
5 years, 3 months ago (2015-09-01 22:38:01 UTC) #7
Dan Beam
On 2015/09/01 22:38:01, Charlie Reis (OOO till 9-8) wrote: > On 2015/09/01 15:31:37, Dan Beam ...
5 years, 3 months ago (2015-09-04 00:06:10 UTC) #8
Dan Beam
5 years, 3 months ago (2015-09-04 01:11:36 UTC) #9
On 2015/09/04 00:06:10, Dan Beam wrote:
> On 2015/09/01 22:38:01, Charlie Reis (OOO till 9-8) wrote:
> > On 2015/09/01 15:31:37, Dan Beam wrote:
> > > On 2015/08/31 19:07:18, Charlie Reis wrote:
> > > > [+nasko to CC]
> > > > 
> > > > On 2015/08/29 01:26:47, Dan Beam wrote:
> > > > > I think if WebUIs were owned by a RFH instead of RFHM, it'd fix some
> > > wonkiness
> > > > > (or maybe make other wonkiness).  This probably wouldn't allow them to
> be
> > > > > re-used, though, as they currently are.
> > > > 
> > > > I would love to see that happen at some point.  Nasko and I have chatted
> > about
> > > > it, and it seems like WebUI is much more tied to RFH and it's kind of
> > awkward
> > > > tracking its lifetime in RFHM.
> > > > 
> > > > In which cases would the same WebUI object be used for two different
RFHs?
> 
> > > That
> > > > seems odd from a security perspective.
> > > 
> > > Well, currently UberUI::sub_uis_ does this, but I'm pretty sure it was to
> fill
> > a
> > > gap in the framework.
> > > > 
> > > > > By the way: deleting the WebUI earlier works, but I didn't notice the
> > other
> > > > > issues you spotted with this patch (that RenderViewCreated() were only
> > > called
> > > > > for pending/speculative WebUIs) until now.
> > > > 
> > > > Cool.  Just ping me when it's ready for another round.
> > > 
> > > I'm not sure it's worth making this class a WebContentsObserver just to
use
> > > web_contents()
> > 
> > I think the RenderViewCreated call can still work if you check the target
> > frame's SiteInstance.
> 
> This isn't guaranteed, though, right?
>
https://code.google.com/p/chromium/codesearch#chromium/src/content/public/bro...
> 
> > 
> > (Plus the original reason for making this class a WebContentsObserver was to
> > listen to navigation commits, but I suppose that's only useful depending on
> how
> > the JS issue gets fixed.)
> 
> Correct
> 
> > 
> > Anyway, up to you if this is no longer a useful change.
> 
> If we really want to change how WebUIs are destructed, I guess we can, but I
> foresee subtle issues...

how WebUIs are destroyed**

Powered by Google App Engine
This is Rietveld 408576698