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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 void Browser::OnStart(const shell::Identity& identity) { | 868 void Browser::OnStart(const shell::Identity& identity) { |
869 tracing_.Initialize(connector(), identity.name()); | 869 tracing_.Initialize(connector(), identity.name()); |
870 | 870 |
871 aura_init_.reset( | 871 aura_init_.reset( |
872 new views::AuraInit(connector(), "views_mus_resources.pak")); | 872 new views::AuraInit(connector(), "views_mus_resources.pak")); |
873 window_manager_connection_ = | 873 window_manager_connection_ = |
874 views::WindowManagerConnection::Create(connector(), identity); | 874 views::WindowManagerConnection::Create(connector(), identity); |
875 } | 875 } |
876 | 876 |
877 bool Browser::OnConnect(shell::Connection* connection) { | 877 bool Browser::OnConnect(const shell::Identity& remote_identity, |
878 connection->AddInterface<mojom::Launchable>(this); | 878 shell::InterfaceRegistry* registry) { |
| 879 registry->AddInterface<mojom::Launchable>(this); |
879 return true; | 880 return true; |
880 } | 881 } |
881 | 882 |
882 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { | 883 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { |
883 bool reuse = | 884 bool reuse = |
884 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; | 885 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; |
885 if (reuse && !windows_.empty()) { | 886 if (reuse && !windows_.empty()) { |
886 windows_.back()->Activate(); | 887 windows_.back()->Activate(); |
887 return; | 888 return; |
888 } | 889 } |
889 | 890 |
890 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); | 891 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); |
891 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 892 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
892 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); | 893 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); |
893 ui->NavigateTo(GURL("http://www.google.com/")); | 894 ui->NavigateTo(GURL("http://www.google.com/")); |
894 window->Show(); | 895 window->Show(); |
895 AddWindow(window); | 896 AddWindow(window); |
896 } | 897 } |
897 | 898 |
898 void Browser::Create(const shell::Identity& remote_identity, | 899 void Browser::Create(const shell::Identity& remote_identity, |
899 mojom::LaunchableRequest request) { | 900 mojom::LaunchableRequest request) { |
900 bindings_.AddBinding(this, std::move(request)); | 901 bindings_.AddBinding(this, std::move(request)); |
901 } | 902 } |
902 | 903 |
903 } // namespace browser | 904 } // namespace browser |
904 } // namespace mash | 905 } // namespace mash |
OLD | NEW |