Merge pull request #8 from aroben/atom
InspectableWebContents should be able to accept existing WebContents.
This commit is contained in:
commit
7d9e271333
4 changed files with 12 additions and 4 deletions
|
@ -5,7 +5,11 @@
|
|||
namespace brightray {
|
||||
|
||||
InspectableWebContents* InspectableWebContents::Create(const content::WebContents::CreateParams& create_params) {
|
||||
return new InspectableWebContentsImpl(create_params);
|
||||
return Create(content::WebContents::Create(create_params));
|
||||
}
|
||||
|
||||
InspectableWebContents* InspectableWebContents::Create(content::WebContents* web_contents) {
|
||||
return new InspectableWebContentsImpl(web_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@ class InspectableWebContentsView;
|
|||
class InspectableWebContents {
|
||||
public:
|
||||
static InspectableWebContents* Create(const content::WebContents::CreateParams&);
|
||||
|
||||
// The returned InspectableWebContents takes ownership of the passed-in WebContents.
|
||||
static InspectableWebContents* Create(content::WebContents*);
|
||||
|
||||
virtual ~InspectableWebContents() {}
|
||||
|
||||
virtual InspectableWebContentsView* GetView() const = 0;
|
||||
|
|
|
@ -36,8 +36,8 @@ void InspectableWebContentsImpl::RegisterPrefs(PrefRegistrySimple* registry) {
|
|||
registry->RegisterStringPref(kDockSidePref, "bottom");
|
||||
}
|
||||
|
||||
InspectableWebContentsImpl::InspectableWebContentsImpl(const content::WebContents::CreateParams& create_params)
|
||||
: web_contents_(content::WebContents::Create(create_params)) {
|
||||
InspectableWebContentsImpl::InspectableWebContentsImpl(content::WebContents* web_contents)
|
||||
: web_contents_(web_contents) {
|
||||
auto context = static_cast<BrowserContext*>(web_contents_->GetBrowserContext());
|
||||
dock_side_ = context->prefs()->GetString(kDockSidePref);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class InspectableWebContentsImpl :
|
|||
public:
|
||||
static void RegisterPrefs(PrefRegistrySimple*);
|
||||
|
||||
InspectableWebContentsImpl(const content::WebContents::CreateParams&);
|
||||
InspectableWebContentsImpl(content::WebContents*);
|
||||
virtual ~InspectableWebContentsImpl() OVERRIDE;
|
||||
|
||||
virtual InspectableWebContentsView* GetView() const OVERRIDE;
|
||||
|
|
Loading…
Reference in a new issue