| 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 Load(ServiceManager* service_manager, | 131 virtual void LoadService(ServiceManager* service_manager, |
| 132 const GURL& url, | 132 const GURL& url, |
| 133 scoped_refptr<LoadCallbacks> callbacks) MOJO_OVERRIDE { | 133 ScopedMessagePipeHandle shell_handle) MOJO_OVERRIDE { |
| 134 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | |
| 135 if (!shell_handle.is_valid()) | |
| 136 return; | |
| 137 scoped_ptr<ApplicationImpl> app( | 134 scoped_ptr<ApplicationImpl> app( |
| 138 new ApplicationImpl(this, shell_handle.Pass())); | 135 new ApplicationImpl(this, shell_handle.Pass())); |
| 139 apps_.push_back(app.release()); | 136 apps_.push_back(app.release()); |
| 140 } | 137 } |
| 141 virtual void OnServiceError(ServiceManager* service_manager, | 138 virtual void OnServiceError(ServiceManager* service_manager, |
| 142 const GURL& url) MOJO_OVERRIDE { | 139 const GURL& url) MOJO_OVERRIDE { |
| 143 } | 140 } |
| 144 | 141 |
| 145 // Overridden from ApplicationDelegate: | 142 // Overridden from ApplicationDelegate: |
| 146 virtual bool ConfigureIncomingConnection( | 143 virtual bool ConfigureIncomingConnection( |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 293 |
| 297 Id second_window = OpenWindow(window_manager_.get()); | 294 Id second_window = OpenWindow(window_manager_.get()); |
| 298 window_manager_->ActivateWindow(second_window, | 295 window_manager_->ActivateWindow(second_window, |
| 299 base::Bind(&EmptyResultCallback)); | 296 base::Bind(&EmptyResultCallback)); |
| 300 ids = WaitForActiveWindowChange(); | 297 ids = WaitForActiveWindowChange(); |
| 301 EXPECT_EQ(ids.first, first_window); | 298 EXPECT_EQ(ids.first, first_window); |
| 302 EXPECT_EQ(ids.second, second_window); | 299 EXPECT_EQ(ids.second, second_window); |
| 303 } | 300 } |
| 304 | 301 |
| 305 } // namespace mojo | 302 } // namespace mojo |
| OLD | NEW |