| 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 "services/ui/view_manager/view_manager_app.h" | 5 #include "services/ui/view_manager/view_manager_app.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "mojo/application/application_runner_chromium.h" | 13 #include "mojo/application/application_runner_chromium.h" |
| 14 #include "mojo/common/tracing_impl.h" | 14 #include "mojo/common/tracing_impl.h" |
| 15 #include "mojo/public/c/system/main.h" | 15 #include "mojo/public/c/system/main.h" |
| 16 #include "mojo/public/cpp/application/application_connection.h" | 16 #include "mojo/public/cpp/application/application_connection.h" |
| 17 #include "mojo/public/cpp/application/application_impl.h" | 17 #include "mojo/public/cpp/application/application_impl.h" |
| 18 #include "mojo/public/cpp/application/connect.h" |
| 18 #include "services/ui/view_manager/view_manager_impl.h" | 19 #include "services/ui/view_manager/view_manager_impl.h" |
| 19 | 20 |
| 20 namespace view_manager { | 21 namespace view_manager { |
| 21 | 22 |
| 22 ViewManagerApp::ViewManagerApp() : app_impl_(nullptr) {} | 23 ViewManagerApp::ViewManagerApp() : app_impl_(nullptr) {} |
| 23 | 24 |
| 24 ViewManagerApp::~ViewManagerApp() {} | 25 ViewManagerApp::~ViewManagerApp() {} |
| 25 | 26 |
| 26 void ViewManagerApp::Initialize(mojo::ApplicationImpl* app_impl) { | 27 void ViewManagerApp::Initialize(mojo::ApplicationImpl* app_impl) { |
| 27 app_impl_ = app_impl; | 28 app_impl_ = app_impl; |
| 28 | 29 |
| 29 auto command_line = base::CommandLine::ForCurrentProcess(); | 30 auto command_line = base::CommandLine::ForCurrentProcess(); |
| 30 command_line->InitFromArgv(app_impl_->args()); | 31 command_line->InitFromArgv(app_impl_->args()); |
| 31 logging::LoggingSettings settings; | 32 logging::LoggingSettings settings; |
| 32 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 33 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 33 logging::InitLogging(settings); | 34 logging::InitLogging(settings); |
| 34 | 35 |
| 35 tracing_.Initialize(app_impl_); | 36 tracing_.Initialize(app_impl_); |
| 36 | 37 |
| 37 // Connect to compositor. | 38 // Connect to compositor. |
| 38 mojo::gfx::composition::CompositorPtr compositor; | 39 mojo::gfx::composition::CompositorPtr compositor; |
| 39 app_impl_->ConnectToServiceDeprecated("mojo:compositor_service", &compositor); | 40 mojo::ConnectToService(app_impl_->shell(), "mojo:compositor_service", |
| 41 GetProxy(&compositor)); |
| 40 compositor.set_connection_error_handler(base::Bind( | 42 compositor.set_connection_error_handler(base::Bind( |
| 41 &ViewManagerApp::OnCompositorConnectionError, base::Unretained(this))); | 43 &ViewManagerApp::OnCompositorConnectionError, base::Unretained(this))); |
| 42 | 44 |
| 43 // Create the registry. | 45 // Create the registry. |
| 44 registry_.reset(new ViewRegistry(compositor.Pass())); | 46 registry_.reset(new ViewRegistry(compositor.Pass())); |
| 45 | 47 |
| 46 // Connect to associates. | 48 // Connect to associates. |
| 47 // TODO(jeffbrown): Consider making the launcher register associates | 49 // TODO(jeffbrown): Consider making the launcher register associates |
| 48 // with the view manager or perhaps per view tree. | 50 // with the view manager or perhaps per view tree. |
| 49 std::vector<std::string> associate_urls = command_line->GetArgs(); | 51 std::vector<std::string> associate_urls = command_line->GetArgs(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 79 void ViewManagerApp::OnAssociateConnectionError(const std::string& url) { | 81 void ViewManagerApp::OnAssociateConnectionError(const std::string& url) { |
| 80 LOG(ERROR) << "Exiting due to view associate connection error: url=" << url; | 82 LOG(ERROR) << "Exiting due to view associate connection error: url=" << url; |
| 81 Shutdown(); | 83 Shutdown(); |
| 82 } | 84 } |
| 83 | 85 |
| 84 void ViewManagerApp::Shutdown() { | 86 void ViewManagerApp::Shutdown() { |
| 85 app_impl_->Terminate(); | 87 app_impl_->Terminate(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 } // namespace view_manager | 90 } // namespace view_manager |
| OLD | NEW |