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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 } | 880 } |
881 | 881 |
882 void Browser::OnStart() { | 882 void Browser::OnStart() { |
883 tracing_.Initialize(context()->connector(), context()->identity().name()); | 883 tracing_.Initialize(context()->connector(), context()->identity().name()); |
884 | 884 |
885 aura_init_ = base::MakeUnique<views::AuraInit>( | 885 aura_init_ = base::MakeUnique<views::AuraInit>( |
886 context()->connector(), context()->identity(), "views_mus_resources.pak", | 886 context()->connector(), context()->identity(), "views_mus_resources.pak", |
887 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); | 887 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
888 } | 888 } |
889 | 889 |
890 void Browser::OnBindInterface(const service_manager::ServiceInfo& source_info, | 890 void Browser::OnBindInterface( |
891 const std::string& interface_name, | 891 const service_manager::BindSourceInfo& source_info, |
892 mojo::ScopedMessagePipeHandle interface_pipe) { | 892 const std::string& interface_name, |
| 893 mojo::ScopedMessagePipeHandle interface_pipe) { |
893 registry_.BindInterface(source_info.identity, interface_name, | 894 registry_.BindInterface(source_info.identity, interface_name, |
894 std::move(interface_pipe)); | 895 std::move(interface_pipe)); |
895 } | 896 } |
896 | 897 |
897 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { | 898 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { |
898 bool reuse = | 899 bool reuse = |
899 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; | 900 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; |
900 if (reuse && !windows_.empty()) { | 901 if (reuse && !windows_.empty()) { |
901 windows_.back()->Activate(); | 902 windows_.back()->Activate(); |
902 return; | 903 return; |
903 } | 904 } |
904 | 905 |
905 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); | 906 UI* ui = new UI(this, UI::Type::WINDOW, CreateView()); |
906 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 907 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
907 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); | 908 ui, nullptr, gfx::Rect(10, 10, 1024, 600)); |
908 ui->NavigateTo(GURL("http://www.google.com/")); | 909 ui->NavigateTo(GURL("http://www.google.com/")); |
909 window->Show(); | 910 window->Show(); |
910 AddWindow(window); | 911 AddWindow(window); |
911 } | 912 } |
912 | 913 |
913 void Browser::Create(const service_manager::Identity& remote_identity, | 914 void Browser::Create(const service_manager::Identity& remote_identity, |
914 mojom::LaunchableRequest request) { | 915 mojom::LaunchableRequest request) { |
915 bindings_.AddBinding(this, std::move(request)); | 916 bindings_.AddBinding(this, std::move(request)); |
916 } | 917 } |
917 | 918 |
918 } // namespace browser | 919 } // namespace browser |
919 } // namespace mash | 920 } // namespace mash |
OLD | NEW |