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

Unified Diff: services/navigation/view_impl.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/navigation/view_impl.h ('k') | services/shell/standalone/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/navigation/view_impl.cc
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc
index de69b0537c53dcf7a4dcbf3abf048200c36f13cf..c2d6b5e30f63a2ba92814d17a03a086b2bce8252 100644
--- a/services/navigation/view_impl.cc
+++ b/services/navigation/view_impl.cc
@@ -61,10 +61,8 @@ mojom::NavigationEntryPtr EntryPtrFromNavEntry(
ViewImpl::ViewImpl(std::unique_ptr<shell::Connector> connector,
const std::string& client_user_id,
mojom::ViewClientPtr client,
- mojom::ViewRequest request,
std::unique_ptr<shell::ServiceContextRef> ref)
: connector_(std::move(connector)),
- binding_(this, std::move(request)),
client_(std::move(client)),
ref_(std::move(ref)),
web_view_(new views::WebView(
@@ -152,17 +150,19 @@ void ViewImpl::AddNewContents(content::WebContents* source,
const std::string new_user_id =
content::BrowserContext::GetShellUserIdFor(
new_contents->GetBrowserContext());
- ViewImpl* impl = new ViewImpl(
- connector_->Clone(), new_user_id, std::move(client),
- std::move(view_request), ref_->Clone());
+ auto impl = base::MakeUnique<ViewImpl>(connector_->Clone(), new_user_id,
+ std::move(client), ref_->Clone());
+
// TODO(beng): This is a bit crappy. should be able to create the ViewImpl
// with |new_contents| instead.
impl->web_view_->SetWebContents(new_contents);
- impl->web_view_->GetWebContents()->SetDelegate(impl);
+ impl->web_view_->GetWebContents()->SetDelegate(impl.get());
// TODO(beng): this reply is currently synchronous, figure out a fix.
if (was_blocked)
*was_blocked = false;
+
+ mojo::MakeStrongBinding(std::move(impl), std::move(view_request));
}
void ViewImpl::CloseContents(content::WebContents* source) {
« no previous file with comments | « services/navigation/view_impl.h ('k') | services/shell/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698