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

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

Issue 687273002: mojo: Update content handler API (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rename content_handler.h 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
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::ConnectToApplication(
45 const std::string& application_url,
46 InterfaceRequest<ServiceProvider> request) {
47 CHECK(application_impl_);
48 application_impl_->shell()->ConnectToApplication(application_url,
49 request.Pass());
50 }
51
52 } // namespace apps
53 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698