Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: mandoline/ui/desktop_ui/browser_manager.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mandoline/ui/desktop_ui/browser_apptest.cc ('k') | mandoline/ui/desktop_ui/browser_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 tracing_.Initialize(app);
53 53
54 mojo::URLRequestPtr request(mojo::URLRequest::New()); 54 app_->ConnectToService("mojo:mus", &host_factory_);
55 request->url = "mojo:mus";
56 app_->ConnectToService(request.Pass(), &host_factory_);
57 55
58 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 56 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
59 // Create a Browser for each valid URL in the command line. 57 // Create a Browser for each valid URL in the command line.
60 for (const auto& arg : command_line->GetArgs()) { 58 for (const auto& arg : command_line->GetArgs()) {
61 GURL url(arg); 59 GURL url(arg);
62 if (url.is_valid()) 60 if (url.is_valid())
63 CreateBrowser(url); 61 CreateBrowser(url);
64 } 62 }
65 // If there were no valid URLs in the command line create a Browser with the 63 // If there were no valid URLs in the command line create a Browser with the
66 // default URL. 64 // default URL.
67 if (browsers_.empty()) 65 if (browsers_.empty())
68 CreateBrowser(GURL(kGoogleURL)); 66 CreateBrowser(GURL(kGoogleURL));
69 } 67 }
70 68
71 bool BrowserManager::ConfigureIncomingConnection( 69 bool BrowserManager::ConfigureIncomingConnection(
72 mojo::ApplicationConnection* connection) { 70 mojo::ApplicationConnection* connection) {
73 connection->AddService<LaunchHandler>(this); 71 connection->AddService<LaunchHandler>(this);
74 return true; 72 return true;
75 } 73 }
76 74
77 void BrowserManager::Create(mojo::ApplicationConnection* connection, 75 void BrowserManager::Create(mojo::ApplicationConnection* connection,
78 mojo::InterfaceRequest<LaunchHandler> request) { 76 mojo::InterfaceRequest<LaunchHandler> request) {
79 launch_handler_bindings_.AddBinding(this, request.Pass()); 77 launch_handler_bindings_.AddBinding(this, request.Pass());
80 } 78 }
81 79
82 } // namespace mandoline 80 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/ui/desktop_ui/browser_apptest.cc ('k') | mandoline/ui/desktop_ui/browser_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698