| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 11 #include "mojo/public/cpp/application/application_delegate.h" |
| 11 #include "mojo/public/cpp/application/application_impl.h" | 12 #include "mojo/public/cpp/application/application_impl.h" |
| 12 #include "mojo/services/public/cpp/view_manager/node.h" | 13 #include "mojo/services/public/cpp/view_manager/node.h" |
| 13 #include "mojo/services/public/cpp/view_manager/node_observer.h" | 14 #include "mojo/services/public/cpp/view_manager/node_observer.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view.h" | 15 #include "mojo/services/public/cpp/view_manager/view.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 16 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 16 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 17 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 18 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Overridden from ViewManagerDelegate: | 91 // Overridden from ViewManagerDelegate: |
| 91 virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE { | 92 virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE { |
| 92 View* view = View::Create(view_manager); | 93 View* view = View::Create(view_manager); |
| 93 view->AddObserver(this); | 94 view->AddObserver(this); |
| 94 root->SetActiveView(view); | 95 root->SetActiveView(view); |
| 95 root->AddObserver(this); | 96 root->AddObserver(this); |
| 96 | 97 |
| 97 roots_[root->id()] = root; | 98 roots_[root->id()] = root; |
| 98 ProcessPendingNodeColor(root->id()); | 99 ProcessPendingNodeColor(root->id()); |
| 99 } | 100 } |
| 101 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE { |
| 102 base::MessageLoop::current()->Quit(); |
| 103 } |
| 100 | 104 |
| 101 // Overridden from ViewObserver: | 105 // Overridden from ViewObserver: |
| 102 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { | 106 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { |
| 103 if (event->action == ui::ET_MOUSE_RELEASED) { | 107 if (event->action == ui::ET_MOUSE_RELEASED) { |
| 104 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON) { | 108 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON) { |
| 105 navigation::NavigationDetailsPtr nav_details( | 109 navigation::NavigationDetailsPtr nav_details( |
| 106 navigation::NavigationDetails::New()); | 110 navigation::NavigationDetails::New()); |
| 107 nav_details->url = "http://www.aaronboodman.com/z_dropbox/test.html"; | 111 nav_details->url = "http://www.aaronboodman.com/z_dropbox/test.html"; |
| 108 navigator_host_->RequestNavigate(view->node()->id(), | 112 navigator_host_->RequestNavigate(view->node()->id(), |
| 109 navigation::SOURCE_NODE, | 113 navigation::SOURCE_NODE, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 } // namespace examples | 161 } // namespace examples |
| 158 | 162 |
| 159 // static | 163 // static |
| 160 ApplicationDelegate* ApplicationDelegate::Create() { | 164 ApplicationDelegate* ApplicationDelegate::Create() { |
| 161 return new examples::EmbeddedApp; | 165 return new examples::EmbeddedApp; |
| 162 } | 166 } |
| 163 | 167 |
| 164 } // namespace mojo | 168 } // namespace mojo |
| OLD | NEW |