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

Side by Side Diff: mandoline/ui/browser/browser.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mandoline/ui/browser/browser.h" 5 #include "mandoline/ui/browser/browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/view_manager/public/cpp/view.h" 9 #include "components/view_manager/public/cpp/view.h"
10 #include "components/view_manager/public/cpp/view_manager_init.h" 10 #include "components/view_manager/public/cpp/view_manager_init.h"
(...skipping 22 matching lines...) Expand all
33 Browser::Browser() 33 Browser::Browser()
34 : root_(nullptr), 34 : root_(nullptr),
35 content_(nullptr), 35 content_(nullptr),
36 omnibox_(nullptr), 36 omnibox_(nullptr),
37 navigator_host_(this), 37 navigator_host_(this),
38 ui_(nullptr) { 38 ui_(nullptr) {
39 exposed_services_impl_.AddService(this); 39 exposed_services_impl_.AddService(this);
40 } 40 }
41 41
42 Browser::~Browser() { 42 Browser::~Browser() {
43 // Destruct ui_ manually while |this| is alive and reset the pointer first.
44 // This is to avoid a double delete when OnViewManagerDisconnected gets
45 // called.
46 delete ui_.release();
43 } 47 }
44 48
45 void Browser::ReplaceContentWithURL(const mojo::String& url) { 49 void Browser::ReplaceContentWithURL(const mojo::String& url) {
46 Embed(url, nullptr, nullptr); 50 Embed(url, nullptr, nullptr);
47 } 51 }
48 52
49 void Browser::Initialize(mojo::ApplicationImpl* app) { 53 void Browser::Initialize(mojo::ApplicationImpl* app) {
50 view_manager_init_.reset(new mojo::ViewManagerInit(app, this, this)); 54 view_manager_init_.reset(new mojo::ViewManagerInit(app, this, this));
51 55
52 ui_.reset(BrowserUI::Create(this, app)); 56 ui_.reset(BrowserUI::Create(this, app));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 168
165 merged_service_provider_.reset( 169 merged_service_provider_.reset(
166 new MergedServiceProvider(exposed_services.Pass(), this)); 170 new MergedServiceProvider(exposed_services.Pass(), this));
167 content_->Embed(url, services.Pass(), 171 content_->Embed(url, services.Pass(),
168 merged_service_provider_->GetServiceProviderPtr().Pass()); 172 merged_service_provider_->GetServiceProviderPtr().Pass());
169 173
170 navigator_host_.RecordNavigation(url); 174 navigator_host_.RecordNavigation(url);
171 } 175 }
172 176
173 } // namespace mandoline 177 } // namespace mandoline
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698