| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/browser/browser.h" | 5 #include "mash/browser/browser.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 if (windows_.empty()) | 860 if (windows_.empty()) |
| 861 base::MessageLoop::current()->QuitWhenIdle(); | 861 base::MessageLoop::current()->QuitWhenIdle(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 std::unique_ptr<navigation::View> Browser::CreateView() { | 864 std::unique_ptr<navigation::View> Browser::CreateView() { |
| 865 navigation::mojom::ViewFactoryPtr factory; | 865 navigation::mojom::ViewFactoryPtr factory; |
| 866 connector()->ConnectToInterface("exe:navigation", &factory); | 866 connector()->ConnectToInterface("exe:navigation", &factory); |
| 867 return base::MakeUnique<navigation::View>(std::move(factory)); | 867 return base::MakeUnique<navigation::View>(std::move(factory)); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void Browser::OnStart(const service_manager::Identity& identity) { | 870 void Browser::OnStart(const service_manager::ServiceInfo& info) { |
| 871 tracing_.Initialize(connector(), identity.name()); | 871 tracing_.Initialize(connector(), info.identity.name()); |
| 872 | 872 |
| 873 aura_init_.reset( | 873 aura_init_.reset( |
| 874 new views::AuraInit(connector(), "views_mus_resources.pak")); | 874 new views::AuraInit(connector(), "views_mus_resources.pak")); |
| 875 window_manager_connection_ = | 875 window_manager_connection_ = |
| 876 views::WindowManagerConnection::Create(connector(), identity); | 876 views::WindowManagerConnection::Create(connector(), info.identity); |
| 877 } | 877 } |
| 878 | 878 |
| 879 bool Browser::OnConnect(const service_manager::Identity& remote_identity, | 879 bool Browser::OnConnect(const service_manager::ServiceInfo& remote_info, |
| 880 service_manager::InterfaceRegistry* registry) { | 880 service_manager::InterfaceRegistry* registry) { |
| 881 registry->AddInterface<mojom::Launchable>(this); | 881 registry->AddInterface<mojom::Launchable>(this); |
| 882 return true; | 882 return true; |
| 883 } | 883 } |
| 884 | 884 |
| 885 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { | 885 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { |
| 886 bool reuse = | 886 bool reuse = |
| 887 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; | 887 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; |
| 888 if (reuse && !windows_.empty()) { | 888 if (reuse && !windows_.empty()) { |
| 889 windows_.back()->Activate(); | 889 windows_.back()->Activate(); |
| 890 return; | 890 return; |
| 891 } | 891 } |
| 892 | 892 |
| 893 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); | 893 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); |
| 894 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 894 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
| 895 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); | 895 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); |
| 896 ui->NavigateTo(GURL("http://www.google.com/")); | 896 ui->NavigateTo(GURL("http://www.google.com/")); |
| 897 window->Show(); | 897 window->Show(); |
| 898 AddWindow(window); | 898 AddWindow(window); |
| 899 } | 899 } |
| 900 | 900 |
| 901 void Browser::Create(const service_manager::Identity& remote_identity, | 901 void Browser::Create(const service_manager::Identity& remote_identity, |
| 902 mojom::LaunchableRequest request) { | 902 mojom::LaunchableRequest request) { |
| 903 bindings_.AddBinding(this, std::move(request)); | 903 bindings_.AddBinding(this, std::move(request)); |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace browser | 906 } // namespace browser |
| 907 } // namespace mash | 907 } // namespace mash |
| OLD | NEW |