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

Side by Side Diff: mojo/examples/keyboard/keyboard.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/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "mojo/examples/keyboard/keyboard.mojom.h" 8 #include "mojo/examples/keyboard/keyboard.mojom.h"
9 #include "mojo/examples/keyboard/keyboard_delegate.h" 9 #include "mojo/examples/keyboard/keyboard_delegate.h"
10 #include "mojo/examples/keyboard/keyboard_view.h" 10 #include "mojo/examples/keyboard/keyboard_view.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 // view_manager::ViewManagerDelegate: 88 // view_manager::ViewManagerDelegate:
89 virtual void OnRootAdded(view_manager::ViewManager* view_manager, 89 virtual void OnRootAdded(view_manager::ViewManager* view_manager,
90 view_manager::Node* root) OVERRIDE { 90 view_manager::Node* root) OVERRIDE {
91 // TODO: deal with OnRootAdded() being invoked multiple times. 91 // TODO: deal with OnRootAdded() being invoked multiple times.
92 view_manager_ = view_manager; 92 view_manager_ = view_manager;
93 root->SetActiveView(view_manager::View::Create(view_manager)); 93 root->SetActiveView(view_manager::View::Create(view_manager));
94 CreateWidget(root); 94 CreateWidget(root);
95 } 95 }
96 virtual void OnViewManagerDisconnected(
97 view_manager::ViewManager* view_manager) OVERRIDE {
98 DCHECK_EQ(view_manager_, view_manager);
99 view_manager_ = NULL;
100 base::MessageLoop::current()->Quit();
101 }
96 102
97 // KeyboardDelegate: 103 // KeyboardDelegate:
98 virtual void OnKeyPressed(int key_code, int event_flags) OVERRIDE { 104 virtual void OnKeyPressed(int key_code, int event_flags) OVERRIDE {
99 if (!target_) 105 if (!target_)
100 return; 106 return;
101 keyboard_service_->client()->OnKeyboardEvent(target_, key_code, 107 keyboard_service_->client()->OnKeyboardEvent(target_, key_code,
102 event_flags); 108 event_flags);
103 } 109 }
104 110
105 scoped_ptr<ViewsInit> views_init_; 111 scoped_ptr<ViewsInit> views_init_;
(...skipping 18 matching lines...) Expand all
124 } 130 }
125 131
126 } // namespace examples 132 } // namespace examples
127 133
128 // static 134 // static
129 ApplicationDelegate* ApplicationDelegate::Create() { 135 ApplicationDelegate* ApplicationDelegate::Create() {
130 return new examples::Keyboard; 136 return new examples::Keyboard;
131 } 137 }
132 138
133 } // namespace mojo 139 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698