OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "mojo/public/cpp/application/application_delegate.h" | 7 #include "mojo/public/cpp/application/application_delegate.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
9 #include "mojo/service_manager/service_manager.h" | 9 #include "mojo/service_manager/service_manager.h" |
10 #include "mojo/services/public/cpp/view_manager/node.h" | 10 #include "mojo/services/public/cpp/view_manager/node.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 public: | 121 public: |
122 typedef base::Callback<void(Node*)> RootAddedCallback; | 122 typedef base::Callback<void(Node*)> RootAddedCallback; |
123 | 123 |
124 explicit TestServiceLoader(const RootAddedCallback& root_added_callback) | 124 explicit TestServiceLoader(const RootAddedCallback& root_added_callback) |
125 : root_added_callback_(root_added_callback), | 125 : root_added_callback_(root_added_callback), |
126 view_manager_client_factory_(this) {} | 126 view_manager_client_factory_(this) {} |
127 virtual ~TestServiceLoader() {} | 127 virtual ~TestServiceLoader() {} |
128 | 128 |
129 private: | 129 private: |
130 // Overridden from ServiceLoader: | 130 // Overridden from ServiceLoader: |
131 virtual void LoadService(ServiceManager* service_manager, | 131 virtual void Load(ServiceManager* service_manager, |
132 const GURL& url, | 132 const GURL& url, |
133 ScopedMessagePipeHandle shell_handle) MOJO_OVERRIDE { | 133 scoped_refptr<LoadCallbacks> callbacks) MOJO_OVERRIDE { |
| 134 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); |
| 135 if (!shell_handle.is_valid()) |
| 136 return; |
134 scoped_ptr<ApplicationImpl> app( | 137 scoped_ptr<ApplicationImpl> app( |
135 new ApplicationImpl(this, shell_handle.Pass())); | 138 new ApplicationImpl(this, shell_handle.Pass())); |
136 apps_.push_back(app.release()); | 139 apps_.push_back(app.release()); |
137 } | 140 } |
138 virtual void OnServiceError(ServiceManager* service_manager, | 141 virtual void OnServiceError(ServiceManager* service_manager, |
139 const GURL& url) MOJO_OVERRIDE { | 142 const GURL& url) MOJO_OVERRIDE { |
140 } | 143 } |
141 | 144 |
142 // Overridden from ApplicationDelegate: | 145 // Overridden from ApplicationDelegate: |
143 virtual bool ConfigureIncomingConnection( | 146 virtual bool ConfigureIncomingConnection( |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 296 |
294 Id second_window = OpenWindow(window_manager_.get()); | 297 Id second_window = OpenWindow(window_manager_.get()); |
295 window_manager_->ActivateWindow(second_window, | 298 window_manager_->ActivateWindow(second_window, |
296 base::Bind(&EmptyResultCallback)); | 299 base::Bind(&EmptyResultCallback)); |
297 ids = WaitForActiveWindowChange(); | 300 ids = WaitForActiveWindowChange(); |
298 EXPECT_EQ(ids.first, first_window); | 301 EXPECT_EQ(ids.first, first_window); |
299 EXPECT_EQ(ids.second, second_window); | 302 EXPECT_EQ(ids.second, second_window); |
300 } | 303 } |
301 | 304 |
302 } // namespace mojo | 305 } // namespace mojo |
OLD | NEW |