Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: mojo/examples/nesting_app/nesting_app.cc

Issue 372273004: Shutdown cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop/message_loop.h"
7 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
8 #include "mojo/examples/window_manager/window_manager.mojom.h" 9 #include "mojo/examples/window_manager/window_manager.mojom.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/services/public/cpp/view_manager/node.h" 12 #include "mojo/services/public/cpp/view_manager/node.h"
12 #include "mojo/services/public/cpp/view_manager/node_observer.h" 13 #include "mojo/services/public/cpp/view_manager/node_observer.h"
13 #include "mojo/services/public/cpp/view_manager/view.h" 14 #include "mojo/services/public/cpp/view_manager/view.h"
14 #include "mojo/services/public/cpp/view_manager/view_manager.h" 15 #include "mojo/services/public/cpp/view_manager/view_manager.h"
15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 16 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
16 #include "mojo/services/public/cpp/view_manager/view_observer.h" 17 #include "mojo/services/public/cpp/view_manager/view_observer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 view->SetColor(SK_ColorCYAN); 88 view->SetColor(SK_ColorCYAN);
88 view->AddObserver(this); 89 view->AddObserver(this);
89 90
90 nested_ = Node::Create(view_manager); 91 nested_ = Node::Create(view_manager);
91 root->AddChild(nested_); 92 root->AddChild(nested_);
92 nested_->SetBounds(gfx::Rect(20, 20, 50, 50)); 93 nested_->SetBounds(gfx::Rect(20, 20, 50, 50));
93 nested_->Embed(kEmbeddedAppURL); 94 nested_->Embed(kEmbeddedAppURL);
94 95
95 NavigateChild(); 96 NavigateChild();
96 } 97 }
98 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE {
99 base::MessageLoop::current()->Quit();
100 }
97 101
98 // Overridden from ViewObserver: 102 // Overridden from ViewObserver:
99 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { 103 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE {
100 if (event->action == ui::ET_MOUSE_RELEASED) 104 if (event->action == ui::ET_MOUSE_RELEASED)
101 window_manager_->CloseWindow(view->node()->id()); 105 window_manager_->CloseWindow(view->node()->id());
102 } 106 }
103 107
104 // Overridden from NodeObserver: 108 // Overridden from NodeObserver:
105 virtual void OnNodeDestroyed(Node* node) OVERRIDE { 109 virtual void OnNodeDestroyed(Node* node) OVERRIDE {
106 // TODO(beng): reap views & child nodes. 110 // TODO(beng): reap views & child nodes.
(...skipping 23 matching lines...) Expand all
130 }; 134 };
131 135
132 } // namespace examples 136 } // namespace examples
133 137
134 // static 138 // static
135 ApplicationDelegate* ApplicationDelegate::Create() { 139 ApplicationDelegate* ApplicationDelegate::Create() {
136 return new examples::NestingApp; 140 return new examples::NestingApp;
137 } 141 }
138 142
139 } // namespace mojo 143 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698