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

Side by Side Diff: mojo/shell/app_container.cc

Issue 51373002: NativeViewport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nl Created 7 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 | Annotate | Revision Log
« no previous file with comments | « mojo/shell/app_container.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shell/app_container.h" 5 #include "mojo/shell/app_container.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/native_library.h" 11 #include "base/native_library.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "mojo/public/system/core.h" 14 #include "mojo/public/system/core.h"
15 #include "mojo/services/native_viewport/native_viewport_controller.h"
15 #include "mojo/shell/context.h" 16 #include "mojo/shell/context.h"
16 17
17 typedef MojoResult (*MojoMainFunction)(mojo::Handle pipe); 18 typedef MojoResult (*MojoMainFunction)(mojo::Handle pipe);
18 19
19 namespace mojo { 20 namespace mojo {
20 namespace shell { 21 namespace shell {
21 22
22 void LaunchAppOnThread( 23 void LaunchAppOnThread(
23 const base::FilePath& app_path, 24 const base::FilePath& app_path,
24 Handle app_handle) { 25 Handle app_handle) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::Bind(&LaunchAppOnThread, app_path, app_handle), 83 base::Bind(&LaunchAppOnThread, app_path, app_handle),
83 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr())); 84 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr()));
84 85
85 const char* hello_msg = "Hello"; 86 const char* hello_msg = "Hello";
86 result = WriteMessage(shell_handle_, hello_msg, 87 result = WriteMessage(shell_handle_, hello_msg,
87 static_cast<uint32_t>(strlen(hello_msg)+1), 88 static_cast<uint32_t>(strlen(hello_msg)+1),
88 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); 89 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE);
89 if (result < MOJO_RESULT_OK) { 90 if (result < MOJO_RESULT_OK) {
90 // Failure.. 91 // Failure..
91 } 92 }
93
94 // TODO(beng): This should be created on demand by the NativeViewportService
95 // when it is retrieved by the app.
96 native_viewport_controller_.reset(
97 new services::NativeViewportController(shell_handle_));
92 } 98 }
93 99
94 void AppContainer::AppCompleted() { 100 void AppContainer::AppCompleted() {
101 native_viewport_controller_->Close();
102
95 thread_.reset(); 103 thread_.reset();
96 Close(shell_handle_); 104 Close(shell_handle_);
97
98 // Probably want to do something more sophisticated here, like notify someone
99 // else to do this.
100 base::MessageLoop::current()->Quit();
101 } 105 }
102 106
103 } // namespace shell 107 } // namespace shell
104 } // namespace mojo 108 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/app_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698