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

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

Issue 1538823002: Convert Pass()→std::move() in mojo/ (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 | « mojo/shell/connect_util.cc ('k') | mojo/shell/shell_application_loader.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 "mojo/shell/shell_application_delegate.h" 5 #include "mojo/shell/shell_application_delegate.h"
6 6
7 #include <utility>
8
7 #include "base/process/process.h" 9 #include "base/process/process.h"
8 #include "mojo/application/public/cpp/application_connection.h" 10 #include "mojo/application/public/cpp/application_connection.h"
9 #include "mojo/shell/application_manager.h" 11 #include "mojo/shell/application_manager.h"
10 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
11 13
12 namespace mojo { 14 namespace mojo {
13 namespace shell { 15 namespace shell {
14 16
15 ShellApplicationDelegate::ShellApplicationDelegate( 17 ShellApplicationDelegate::ShellApplicationDelegate(
16 mojo::shell::ApplicationManager* manager) 18 mojo::shell::ApplicationManager* manager)
17 : manager_(manager) {} 19 : manager_(manager) {}
18 ShellApplicationDelegate::~ShellApplicationDelegate() {} 20 ShellApplicationDelegate::~ShellApplicationDelegate() {}
19 21
20 void ShellApplicationDelegate::Initialize(ApplicationImpl* app) {} 22 void ShellApplicationDelegate::Initialize(ApplicationImpl* app) {}
21 bool ShellApplicationDelegate::ConfigureIncomingConnection( 23 bool ShellApplicationDelegate::ConfigureIncomingConnection(
22 ApplicationConnection* connection) { 24 ApplicationConnection* connection) {
23 connection->AddService<mojom::ApplicationManager>(this); 25 connection->AddService<mojom::ApplicationManager>(this);
24 return true; 26 return true;
25 } 27 }
26 28
27 void ShellApplicationDelegate::Create( 29 void ShellApplicationDelegate::Create(
28 ApplicationConnection* connection, 30 ApplicationConnection* connection,
29 InterfaceRequest<mojom::ApplicationManager> request) { 31 InterfaceRequest<mojom::ApplicationManager> request) {
30 bindings_.AddBinding(this, request.Pass()); 32 bindings_.AddBinding(this, std::move(request));
31 } 33 }
32 34
33 void ShellApplicationDelegate::CreateInstanceForHandle( 35 void ShellApplicationDelegate::CreateInstanceForHandle(
34 ScopedHandle channel, 36 ScopedHandle channel,
35 const String& url, 37 const String& url,
36 CapabilityFilterPtr filter) { 38 CapabilityFilterPtr filter) {
37 manager_->CreateInstanceForHandle(channel.Pass(), GURL(url), filter.Pass()); 39 manager_->CreateInstanceForHandle(std::move(channel), GURL(url),
40 std::move(filter));
38 } 41 }
39 42
40 void ShellApplicationDelegate::RegisterProcessWithBroker( 43 void ShellApplicationDelegate::RegisterProcessWithBroker(
41 uint32_t pid, ScopedHandle pipe) { 44 uint32_t pid, ScopedHandle pipe) {
42 // First, for security we want to verify that the given pid's grand parent 45 // First, for security we want to verify that the given pid's grand parent
43 // process is us. 46 // process is us.
44 base::Process process = base::Process::OpenWithExtraPrivileges( 47 base::Process process = base::Process::OpenWithExtraPrivileges(
45 static_cast<base::ProcessId>(pid)); 48 static_cast<base::ProcessId>(pid));
46 if (!process.IsValid()) { 49 if (!process.IsValid()) {
47 NOTREACHED(); 50 NOTREACHED();
(...skipping 17 matching lines...) Expand all
65 { 68 {
66 NOTREACHED(); 69 NOTREACHED();
67 return; 70 return;
68 } 71 }
69 } 72 }
70 73
71 embedder::ScopedPlatformHandle platform_pipe; 74 embedder::ScopedPlatformHandle platform_pipe;
72 MojoResult rv = embedder::PassWrappedPlatformHandle( 75 MojoResult rv = embedder::PassWrappedPlatformHandle(
73 pipe.release().value(), &platform_pipe); 76 pipe.release().value(), &platform_pipe);
74 CHECK_EQ(rv, MOJO_RESULT_OK); 77 CHECK_EQ(rv, MOJO_RESULT_OK);
75 embedder::ChildProcessLaunched(process.Handle(), platform_pipe.Pass()); 78 embedder::ChildProcessLaunched(process.Handle(), std::move(platform_pipe));
76 } 79 }
77 80
78 void ShellApplicationDelegate::AddListener( 81 void ShellApplicationDelegate::AddListener(
79 mojom::ApplicationManagerListenerPtr listener) { 82 mojom::ApplicationManagerListenerPtr listener) {
80 manager_->AddListener(std::move(listener)); 83 manager_->AddListener(std::move(listener));
81 } 84 }
82 85
83 } // namespace shell 86 } // namespace shell
84 } // namespace mojo 87 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/connect_util.cc ('k') | mojo/shell/shell_application_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698