OLD | NEW |
| (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/shell/profile_service_loader.h" | |
6 | |
7 #include "mojo/public/cpp/application/application_connection.h" | |
8 #include "mojo/public/cpp/application/application_delegate.h" | |
9 #include "mojo/public/cpp/application/application_impl.h" | |
10 #include "mojo/services/profile/profile_service_impl.h" | |
11 | |
12 namespace mojo { | |
13 namespace shell { | |
14 | |
15 ProfileServiceLoader::ProfileServiceLoader() { | |
16 } | |
17 | |
18 ProfileServiceLoader::~ProfileServiceLoader() { | |
19 } | |
20 | |
21 void ProfileServiceLoader::LoadService( | |
22 ServiceManager* manager, | |
23 const GURL& url, | |
24 ScopedMessagePipeHandle shell_handle) { | |
25 uintptr_t key = reinterpret_cast<uintptr_t>(manager); | |
26 if (apps_.find(key) == apps_.end()) { | |
27 scoped_ptr<ApplicationImpl> app( | |
28 new ApplicationImpl(this, shell_handle.Pass())); | |
29 apps_.add(key, app.Pass()); | |
30 } | |
31 } | |
32 | |
33 void ProfileServiceLoader::OnServiceError(ServiceManager* manager, | |
34 const GURL& url) { | |
35 apps_.erase(reinterpret_cast<uintptr_t>(manager)); | |
36 } | |
37 | |
38 bool ProfileServiceLoader::ConfigureIncomingConnection( | |
39 ApplicationConnection* connection) { | |
40 connection->AddService<ProfileServiceImpl>(); | |
41 return true; | |
42 } | |
43 | |
44 } // namespace shell | |
45 } // namespace mojo | |
OLD | NEW |