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

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

Issue 109103003: Mojo: abstract interface implementation from generated Stub classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + fix build Created 6 years, 11 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 | Annotate | Revision Log
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/service_manager.h" 5 #include "mojo/shell/service_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/public/bindings/lib/remote_ptr.h" 8 #include "mojo/public/bindings/lib/remote_ptr.h"
9 #include "mojom/shell.h" 9 #include "mojom/shell.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 namespace shell { 12 namespace shell {
13 13
14 class ServiceManager::Service : public ShellStub { 14 class ServiceManager::Service : public Shell {
15 public: 15 public:
16 Service(ServiceManager* manager, const GURL& url) 16 Service(ServiceManager* manager, const GURL& url)
17 : manager_(manager), 17 : manager_(manager),
18 url_(url) { 18 url_(url) {
19 MessagePipe pipe; 19 MessagePipe pipe;
20 shell_client_.reset(pipe.handle0.Pass()); 20 shell_client_.reset(pipe.handle0.Pass(), this);
21 shell_client_.SetPeer(this);
22 manager_->GetLoaderForURL(url)->Load(url, pipe.handle1.Pass()); 21 manager_->GetLoaderForURL(url)->Load(url, pipe.handle1.Pass());
23 } 22 }
24 virtual ~Service() {} 23 virtual ~Service() {}
25 24
26 void ConnectToClient(ScopedMessagePipeHandle handle) { 25 void ConnectToClient(ScopedMessagePipeHandle handle) {
27 if (handle.is_valid()) 26 if (handle.is_valid())
28 shell_client_->AcceptConnection(handle.Pass()); 27 shell_client_->AcceptConnection(handle.Pass());
29 } 28 }
30 29
31 virtual void Connect(const String& url, 30 virtual void Connect(const String& url,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 service = service_it->second; 74 service = service_it->second;
76 } else { 75 } else {
77 service = new Service(this, url); 76 service = new Service(this, url);
78 url_to_service_[url] = service; 77 url_to_service_[url] = service;
79 } 78 }
80 service->ConnectToClient(client_handle.Pass()); 79 service->ConnectToClient(client_handle.Pass());
81 } 80 }
82 81
83 } // namespace shell 82 } // namespace shell
84 } // namespace mojo 83 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.cc ('k') | mojo/shell/service_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698