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

Side by Side Diff: mojo/apps/js/application_delegate_impl.cc

Issue 646943006: Remove mojo/apps/js, it is unused (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « mojo/apps/js/application_delegate_impl.h ('k') | mojo/apps/js/bindings/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/apps/js/application_delegate_impl.h"
6
7 #include "gin/array_buffer.h"
8 #include "gin/public/isolate_holder.h"
9 #include "mojo/apps/js/js_app.h"
10 #include "mojo/public/cpp/application/application_impl.h"
11
12 namespace mojo {
13 namespace apps {
14
15 ApplicationDelegateImpl::ApplicationDelegateImpl()
16 : application_impl_(nullptr) {
17 }
18
19 void ApplicationDelegateImpl::Initialize(ApplicationImpl* app) {
20 application_impl_ = app;
21 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
22 gin::ArrayBufferAllocator::SharedInstance());
23 }
24
25 ApplicationDelegateImpl::~ApplicationDelegateImpl() {
26 }
27
28 void ApplicationDelegateImpl::StartJSApp(scoped_ptr<JSApp> app_ptr) {
29 JSApp *app = app_ptr.release();
30 app_vector_.push_back(app);
31 // TODO(hansmuller): deal with the Start() return value.
32 app->Start();
33 }
34
35 void ApplicationDelegateImpl::QuitJSApp(JSApp* app) {
36 AppVector::iterator itr =
37 std::find(app_vector_.begin(), app_vector_.end(), app);
38 if (itr != app_vector_.end())
39 app_vector_.erase(itr);
40 if (app_vector_.empty())
41 base::MessageLoop::current()->QuitNow();
42 }
43
44 void ApplicationDelegateImpl::ConnectToService(
45 ScopedMessagePipeHandle pipe_handle,
46 const std::string& application_url,
47 const std::string& interface_name) {
48 CHECK(application_impl_);
49 ServiceProvider* service_provider =
50 application_impl_->ConnectToApplication(application_url)
51 ->GetServiceProvider();
52 service_provider->ConnectToService(interface_name, pipe_handle.Pass());
53 }
54
55 } // namespace apps
56 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/application_delegate_impl.h ('k') | mojo/apps/js/bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698