| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 class EmbedApplicationLoader : public ApplicationLoader, | 415 class EmbedApplicationLoader : public ApplicationLoader, |
| 416 ApplicationDelegate, | 416 ApplicationDelegate, |
| 417 public InterfaceFactory<ViewManagerClient> { | 417 public InterfaceFactory<ViewManagerClient> { |
| 418 public: | 418 public: |
| 419 EmbedApplicationLoader() {} | 419 EmbedApplicationLoader() {} |
| 420 ~EmbedApplicationLoader() override {} | 420 ~EmbedApplicationLoader() override {} |
| 421 | 421 |
| 422 // ApplicationLoader implementation: | 422 // ApplicationLoader implementation: |
| 423 void Load(ApplicationManager* manager, | 423 void Load(ApplicationManager* manager, |
| 424 const GURL& url, | 424 const GURL& url, |
| 425 ScopedMessagePipeHandle shell_handle, |
| 425 scoped_refptr<LoadCallbacks> callbacks) override { | 426 scoped_refptr<LoadCallbacks> callbacks) override { |
| 426 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | 427 ASSERT_TRUE(shell_handle.is_valid()); |
| 427 if (!shell_handle.is_valid()) | 428 scoped_ptr<ApplicationImpl> app( |
| 428 return; | 429 new ApplicationImpl(this, shell_handle.Pass())); |
| 429 scoped_ptr<ApplicationImpl> app(new ApplicationImpl(this, | |
| 430 shell_handle.Pass())); | |
| 431 apps_.push_back(app.release()); | 430 apps_.push_back(app.release()); |
| 432 } | 431 } |
| 433 void OnApplicationError(ApplicationManager* manager, | 432 void OnApplicationError(ApplicationManager* manager, |
| 434 const GURL& url) override {} | 433 const GURL& url) override {} |
| 435 | 434 |
| 436 // ApplicationDelegate implementation: | 435 // ApplicationDelegate implementation: |
| 437 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 436 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 438 connection->AddService<ViewManagerClient>(this); | 437 connection->AddService<ViewManagerClient>(this); |
| 439 return true; | 438 return true; |
| 440 } | 439 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 public ApplicationDelegate, | 509 public ApplicationDelegate, |
| 511 public InterfaceFactory<WindowManager> { | 510 public InterfaceFactory<WindowManager> { |
| 512 public: | 511 public: |
| 513 explicit WindowManagerLoader(EmbedApplicationLoader* app_loader) | 512 explicit WindowManagerLoader(EmbedApplicationLoader* app_loader) |
| 514 : app_loader_(app_loader) {} | 513 : app_loader_(app_loader) {} |
| 515 virtual ~WindowManagerLoader() {} | 514 virtual ~WindowManagerLoader() {} |
| 516 | 515 |
| 517 // ApplicationLoader implementation: | 516 // ApplicationLoader implementation: |
| 518 virtual void Load(ApplicationManager* manager, | 517 virtual void Load(ApplicationManager* manager, |
| 519 const GURL& url, | 518 const GURL& url, |
| 519 ScopedMessagePipeHandle shell_handle, |
| 520 scoped_refptr<LoadCallbacks> callbacks) override { | 520 scoped_refptr<LoadCallbacks> callbacks) override { |
| 521 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | 521 ASSERT_TRUE(shell_handle.is_valid()); |
| 522 if (!shell_handle.is_valid()) | |
| 523 return; | |
| 524 scoped_ptr<ApplicationImpl> app( | 522 scoped_ptr<ApplicationImpl> app( |
| 525 new ApplicationImpl(this, shell_handle.Pass())); | 523 new ApplicationImpl(this, shell_handle.Pass())); |
| 526 apps_.push_back(app.release()); | 524 apps_.push_back(app.release()); |
| 527 } | 525 } |
| 528 virtual void OnApplicationError(ApplicationManager* manager, | 526 virtual void OnApplicationError(ApplicationManager* manager, |
| 529 const GURL& url) override {} | 527 const GURL& url) override {} |
| 530 | 528 |
| 531 // ApplicationDelegate implementation: | 529 // ApplicationDelegate implementation: |
| 532 virtual bool ConfigureIncomingConnection( | 530 virtual bool ConfigureIncomingConnection( |
| 533 ApplicationConnection* connection) override { | 531 ApplicationConnection* connection) override { |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 EXPECT_EQ("PropertyChanged view=1,1 key=one value=NULL", | 1600 EXPECT_EQ("PropertyChanged view=1,1 key=one value=NULL", |
| 1603 ChangesToDescription1(connection2_->changes())[0]); | 1601 ChangesToDescription1(connection2_->changes())[0]); |
| 1604 } | 1602 } |
| 1605 } | 1603 } |
| 1606 | 1604 |
| 1607 // WARNING: this class is deprecated and will be replaced with | 1605 // WARNING: this class is deprecated and will be replaced with |
| 1608 // view_manager_server_apptest soonish. Add new tests there. | 1606 // view_manager_server_apptest soonish. Add new tests there. |
| 1609 | 1607 |
| 1610 } // namespace service | 1608 } // namespace service |
| 1611 } // namespace mojo | 1609 } // namespace mojo |
| OLD | NEW |