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

Side by Side Diff: mojo/application/public/cpp/lib/application_impl.cc

Issue 1143793003: Remove application-specific args from Mandoline's shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 7 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/application/public/cpp/application_impl.h" 5 #include "mojo/application/public/cpp/application_impl.h"
6 6
7 #include "mojo/application/public/cpp/application_delegate.h" 7 #include "mojo/application/public/cpp/application_delegate.h"
8 #include "mojo/application/public/cpp/lib/service_registry.h" 8 #include "mojo/application/public/cpp/lib/service_registry.h"
9 #include "mojo/public/cpp/bindings/interface_ptr.h" 9 #include "mojo/public/cpp/bindings/interface_ptr.h"
10 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
(...skipping 13 matching lines...) Expand all
24 MOJO_DISALLOW_COPY_AND_ASSIGN(ShellPtrWatcher); 24 MOJO_DISALLOW_COPY_AND_ASSIGN(ShellPtrWatcher);
25 }; 25 };
26 26
27 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, 27 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
28 InterfaceRequest<Application> request) 28 InterfaceRequest<Application> request)
29 : delegate_(delegate), 29 : delegate_(delegate),
30 binding_(this, request.Pass()), 30 binding_(this, request.Pass()),
31 shell_watch_(nullptr) { 31 shell_watch_(nullptr) {
32 } 32 }
33 33
34 bool ApplicationImpl::HasArg(const std::string& arg) const {
35 return std::find(args_.begin(), args_.end(), arg) != args_.end();
36 }
37
38 void ApplicationImpl::ClearConnections() { 34 void ApplicationImpl::ClearConnections() {
39 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin()); 35 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin());
40 i != incoming_service_registries_.end(); 36 i != incoming_service_registries_.end();
41 ++i) 37 ++i)
42 delete *i; 38 delete *i;
43 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin()); 39 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin());
44 i != outgoing_service_registries_.end(); 40 i != outgoing_service_registries_.end();
45 ++i) 41 ++i)
46 delete *i; 42 delete *i;
47 incoming_service_registries_.clear(); 43 incoming_service_registries_.clear();
(...skipping 17 matching lines...) Expand all
65 this, application_url, application_url, remote_services.Pass(), 61 this, application_url, application_url, remote_services.Pass(),
66 local_request.Pass()); 62 local_request.Pass());
67 if (!delegate_->ConfigureOutgoingConnection(registry)) { 63 if (!delegate_->ConfigureOutgoingConnection(registry)) {
68 delete registry; 64 delete registry;
69 return nullptr; 65 return nullptr;
70 } 66 }
71 outgoing_service_registries_.push_back(registry); 67 outgoing_service_registries_.push_back(registry);
72 return registry; 68 return registry;
73 } 69 }
74 70
75 void ApplicationImpl::Initialize(ShellPtr shell, 71 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
76 Array<String> args,
77 const mojo::String& url) {
78 shell_ = shell.Pass(); 72 shell_ = shell.Pass();
79 shell_watch_ = new ShellPtrWatcher(this); 73 shell_watch_ = new ShellPtrWatcher(this);
80 shell_.set_error_handler(shell_watch_); 74 shell_.set_error_handler(shell_watch_);
81 url_ = url; 75 url_ = url;
82 args_ = args.To<std::vector<std::string>>();
83 delegate_->Initialize(this); 76 delegate_->Initialize(this);
84 } 77 }
85 78
86 void ApplicationImpl::WaitForInitialize() { 79 void ApplicationImpl::WaitForInitialize() {
87 if (!shell_) 80 if (!shell_)
88 binding_.WaitForIncomingMethodCall(); 81 binding_.WaitForIncomingMethodCall();
89 } 82 }
90 83
91 void ApplicationImpl::UnbindConnections( 84 void ApplicationImpl::UnbindConnections(
92 InterfaceRequest<Application>* application_request, 85 InterfaceRequest<Application>* application_request,
(...skipping 15 matching lines...) Expand all
108 } 101 }
109 incoming_service_registries_.push_back(registry); 102 incoming_service_registries_.push_back(registry);
110 } 103 }
111 104
112 void ApplicationImpl::RequestQuit() { 105 void ApplicationImpl::RequestQuit() {
113 delegate_->Quit(); 106 delegate_->Quit();
114 Terminate(); 107 Terminate();
115 } 108 }
116 109
117 } // namespace mojo 110 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/public/cpp/application_impl.h ('k') | mojo/application/public/interfaces/application.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698