| 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/desktop_ui/browser_manager.h" | 5 #include "mandoline/ui/desktop_ui/browser_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
| 9 #include "components/mus/public/cpp/window_observer.h" | 9 #include "components/mus/public/cpp/window_observer.h" |
| 10 #include "mandoline/ui/desktop_ui/browser_window.h" | 10 #include "mandoline/ui/desktop_ui/browser_window.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 void BrowserManager::LaunchURL(const mojo::String& url) { | 43 void BrowserManager::LaunchURL(const mojo::String& url) { |
| 44 DCHECK(!browsers_.empty()); | 44 DCHECK(!browsers_.empty()); |
| 45 // TODO(fsamuel): Create a new Browser once we support multiple browser | 45 // TODO(fsamuel): Create a new Browser once we support multiple browser |
| 46 // windows. | 46 // windows. |
| 47 (*browsers_.begin())->LoadURL(GURL(url)); | 47 (*browsers_.begin())->LoadURL(GURL(url)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void BrowserManager::Initialize(mojo::ApplicationImpl* app) { | 50 void BrowserManager::Initialize(mojo::ApplicationImpl* app) { |
| 51 app_ = app; | 51 app_ = app; |
| 52 tracing_.Initialize(app); |
| 52 | 53 |
| 53 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 54 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 54 request->url = "mojo:mus"; | 55 request->url = "mojo:mus"; |
| 55 app_->ConnectToService(request.Pass(), &host_factory_); | 56 app_->ConnectToService(request.Pass(), &host_factory_); |
| 56 | 57 |
| 57 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 58 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 58 // Create a Browser for each valid URL in the command line. | 59 // Create a Browser for each valid URL in the command line. |
| 59 for (const auto& arg : command_line->GetArgs()) { | 60 for (const auto& arg : command_line->GetArgs()) { |
| 60 GURL url(arg); | 61 GURL url(arg); |
| 61 if (url.is_valid()) | 62 if (url.is_valid()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 connection->AddService<LaunchHandler>(this); | 73 connection->AddService<LaunchHandler>(this); |
| 73 return true; | 74 return true; |
| 74 } | 75 } |
| 75 | 76 |
| 76 void BrowserManager::Create(mojo::ApplicationConnection* connection, | 77 void BrowserManager::Create(mojo::ApplicationConnection* connection, |
| 77 mojo::InterfaceRequest<LaunchHandler> request) { | 78 mojo::InterfaceRequest<LaunchHandler> request) { |
| 78 launch_handler_bindings_.AddBinding(this, request.Pass()); | 79 launch_handler_bindings_.AddBinding(this, request.Pass()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace mandoline | 82 } // namespace mandoline |
| OLD | NEW |