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/view.h" | 8 #include "components/mus/public/cpp/view.h" |
9 #include "components/mus/public/cpp/view_observer.h" | 9 #include "components/mus/public/cpp/view_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 DCHECK(!browsers_.empty()); | 42 DCHECK(!browsers_.empty()); |
43 // TODO(fsamuel): Create a new Browser once we support multiple browser | 43 // TODO(fsamuel): Create a new Browser once we support multiple browser |
44 // windows. | 44 // windows. |
45 (*browsers_.begin())->LoadURL(GURL(url)); | 45 (*browsers_.begin())->LoadURL(GURL(url)); |
46 } | 46 } |
47 | 47 |
48 void BrowserManager::Initialize(mojo::ApplicationImpl* app) { | 48 void BrowserManager::Initialize(mojo::ApplicationImpl* app) { |
49 app_ = app; | 49 app_ = app; |
50 | 50 |
51 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 51 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
52 request->url = "mojo:view_manager"; | 52 request->url = "mojo:mus"; |
53 app_->ConnectToService(request.Pass(), &host_factory_); | 53 app_->ConnectToService(request.Pass(), &host_factory_); |
54 | 54 |
55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
56 // Create a Browser for each valid URL in the command line. | 56 // Create a Browser for each valid URL in the command line. |
57 for (const auto& arg : command_line->GetArgs()) { | 57 for (const auto& arg : command_line->GetArgs()) { |
58 GURL url(arg); | 58 GURL url(arg); |
59 if (url.is_valid()) | 59 if (url.is_valid()) |
60 CreateBrowser(url); | 60 CreateBrowser(url); |
61 } | 61 } |
62 // If there were no valid URLs in the command line create a Browser with the | 62 // If there were no valid URLs in the command line create a Browser with the |
63 // default URL. | 63 // default URL. |
64 if (browsers_.empty()) | 64 if (browsers_.empty()) |
65 CreateBrowser(GURL(kGoogleURL)); | 65 CreateBrowser(GURL(kGoogleURL)); |
66 } | 66 } |
67 | 67 |
68 bool BrowserManager::ConfigureIncomingConnection( | 68 bool BrowserManager::ConfigureIncomingConnection( |
69 mojo::ApplicationConnection* connection) { | 69 mojo::ApplicationConnection* connection) { |
70 connection->AddService<LaunchHandler>(this); | 70 connection->AddService<LaunchHandler>(this); |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 void BrowserManager::Create(mojo::ApplicationConnection* connection, | 74 void BrowserManager::Create(mojo::ApplicationConnection* connection, |
75 mojo::InterfaceRequest<LaunchHandler> request) { | 75 mojo::InterfaceRequest<LaunchHandler> request) { |
76 launch_handler_bindings_.AddBinding(this, request.Pass()); | 76 launch_handler_bindings_.AddBinding(this, request.Pass()); |
77 } | 77 } |
78 | 78 |
79 } // namespace mandoline | 79 } // namespace mandoline |
OLD | NEW |