OLD | NEW |
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 "mandoline/ui/browser/browser_ui.h" | 9 #include "mandoline/ui/browser/browser_ui.h" |
10 #include "mandoline/ui/browser/merged_service_provider.h" | 10 #include "mandoline/ui/browser/merged_service_provider.h" |
11 #include "mojo/application/application_runner_chromium.h" | 11 #include "mojo/application/application_runner_chromium.h" |
12 #include "mojo/common/common_type_converters.h" | 12 #include "mojo/common/common_type_converters.h" |
13 #include "third_party/mojo/src/mojo/public/c/system/main.h" | 13 #include "third_party/mojo/src/mojo/public/c/system/main.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 | 15 |
16 namespace mandoline { | 16 namespace mandoline { |
17 | 17 |
18 Browser::Browser() | 18 Browser::Browser() |
19 : window_manager_app_(new window_manager::WindowManagerApp(this, this)), | 19 : window_manager_app_(new window_manager::WindowManagerApp(this, this)), |
20 root_(nullptr), | 20 root_(nullptr), |
21 content_(nullptr), | 21 content_(nullptr), |
22 omnibox_(nullptr), | 22 omnibox_(nullptr), |
23 navigator_host_(this), | 23 navigator_host_(this), |
24 ui_(nullptr), | 24 ui_(nullptr) { |
25 weak_factory_(this) { | |
26 exposed_services_impl_.AddService(this); | 25 exposed_services_impl_.AddService(this); |
27 } | 26 } |
28 | 27 |
29 Browser::~Browser() { | 28 Browser::~Browser() { |
30 } | 29 } |
31 | 30 |
32 base::WeakPtr<Browser> Browser::GetWeakPtr() { | |
33 return weak_factory_.GetWeakPtr(); | |
34 } | |
35 | |
36 void Browser::ReplaceContentWithURL(const mojo::String& url) { | 31 void Browser::ReplaceContentWithURL(const mojo::String& url) { |
37 Embed(url, nullptr, nullptr); | 32 Embed(url, nullptr, nullptr); |
38 } | 33 } |
39 | 34 |
40 void Browser::Initialize(mojo::ApplicationImpl* app) { | 35 void Browser::Initialize(mojo::ApplicationImpl* app) { |
41 window_manager_app_->Initialize(app); | 36 window_manager_app_->Initialize(app); |
42 ui_.reset(BrowserUI::Create(this, app)); | 37 ui_.reset(BrowserUI::Create(this, app)); |
43 | 38 |
44 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
45 base::CommandLine::StringVector args = command_line->GetArgs(); | 40 base::CommandLine::StringVector args = command_line->GetArgs(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if (!omnibox_) { | 155 if (!omnibox_) { |
161 omnibox_ = root_->view_manager()->CreateView(); | 156 omnibox_ = root_->view_manager()->CreateView(); |
162 root_->AddChild(omnibox_); | 157 root_->AddChild(omnibox_); |
163 omnibox_->SetVisible(true); | 158 omnibox_->SetVisible(true); |
164 omnibox_->SetBounds(root_->bounds()); | 159 omnibox_->SetBounds(root_->bounds()); |
165 } | 160 } |
166 omnibox_->Embed(url, services.Pass(), exposed_services.Pass()); | 161 omnibox_->Embed(url, services.Pass(), exposed_services.Pass()); |
167 } | 162 } |
168 | 163 |
169 } // namespace mandoline | 164 } // namespace mandoline |
OLD | NEW |