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

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

Issue 623573002: Mojo: Convert the remaining OVERRIDEs to override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/keyboard/keyboard_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/macros.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/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/examples/keyboard/keyboard.mojom.h" 9 #include "mojo/examples/keyboard/keyboard.mojom.h"
10 #include "mojo/examples/keyboard/keyboard_delegate.h" 10 #include "mojo/examples/keyboard/keyboard_delegate.h"
11 #include "mojo/examples/keyboard/keyboard_view.h" 11 #include "mojo/examples/keyboard/keyboard_view.h"
12 #include "mojo/public/c/system/main.h" 12 #include "mojo/public/c/system/main.h"
13 #include "mojo/public/cpp/application/application_connection.h" 13 #include "mojo/public/cpp/application/application_connection.h"
14 #include "mojo/public/cpp/application/application_delegate.h" 14 #include "mojo/public/cpp/application/application_delegate.h"
15 #include "mojo/public/cpp/application/application_impl.h" 15 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 15 matching lines...) Expand all
31 namespace examples { 31 namespace examples {
32 32
33 class Keyboard; 33 class Keyboard;
34 34
35 class KeyboardServiceImpl : public InterfaceImpl<KeyboardService> { 35 class KeyboardServiceImpl : public InterfaceImpl<KeyboardService> {
36 public: 36 public:
37 explicit KeyboardServiceImpl(Keyboard* keyboard); 37 explicit KeyboardServiceImpl(Keyboard* keyboard);
38 virtual ~KeyboardServiceImpl() {} 38 virtual ~KeyboardServiceImpl() {}
39 39
40 // KeyboardService: 40 // KeyboardService:
41 virtual void SetTarget(uint32_t view_id) OVERRIDE; 41 virtual void SetTarget(uint32_t view_id) override;
42 42
43 private: 43 private:
44 Keyboard* keyboard_; 44 Keyboard* keyboard_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceImpl); 46 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceImpl);
47 }; 47 };
48 48
49 class Keyboard : public ApplicationDelegate, 49 class Keyboard : public ApplicationDelegate,
50 public ViewManagerDelegate, 50 public ViewManagerDelegate,
51 public KeyboardDelegate { 51 public KeyboardDelegate {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 params.delegate = widget_delegate; 92 params.delegate = widget_delegate;
93 params.bounds = gfx::Rect(view->bounds().width(), view->bounds().height()); 93 params.bounds = gfx::Rect(view->bounds().width(), view->bounds().height());
94 widget->Init(params); 94 widget->Init(params);
95 widget->Show(); 95 widget->Show();
96 } 96 }
97 97
98 // ViewManagerDelegate: 98 // ViewManagerDelegate:
99 virtual void OnEmbed(ViewManager* view_manager, 99 virtual void OnEmbed(ViewManager* view_manager,
100 View* root, 100 View* root,
101 ServiceProviderImpl* exported_services, 101 ServiceProviderImpl* exported_services,
102 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { 102 scoped_ptr<ServiceProvider> imported_services) override {
103 // TODO: deal with OnEmbed() being invoked multiple times. 103 // TODO: deal with OnEmbed() being invoked multiple times.
104 view_manager_ = view_manager; 104 view_manager_ = view_manager;
105 CreateWidget(root); 105 CreateWidget(root);
106 } 106 }
107 virtual void OnViewManagerDisconnected( 107 virtual void OnViewManagerDisconnected(
108 ViewManager* view_manager) OVERRIDE { 108 ViewManager* view_manager) override {
109 DCHECK_EQ(view_manager_, view_manager); 109 DCHECK_EQ(view_manager_, view_manager);
110 view_manager_ = NULL; 110 view_manager_ = NULL;
111 base::MessageLoop::current()->Quit(); 111 base::MessageLoop::current()->Quit();
112 } 112 }
113 113
114 // KeyboardDelegate: 114 // KeyboardDelegate:
115 virtual void OnKeyPressed(int key_code, int event_flags) OVERRIDE { 115 virtual void OnKeyPressed(int key_code, int event_flags) override {
116 if (!target_) 116 if (!target_)
117 return; 117 return;
118 keyboard_service_->client()->OnKeyboardEvent(target_, key_code, 118 keyboard_service_->client()->OnKeyboardEvent(target_, key_code,
119 event_flags); 119 event_flags);
120 } 120 }
121 121
122 InterfaceFactoryImplWithContext<KeyboardServiceImpl, Keyboard> 122 InterfaceFactoryImplWithContext<KeyboardServiceImpl, Keyboard>
123 keyboard_service_factory_; 123 keyboard_service_factory_;
124 124
125 scoped_ptr<ViewsInit> views_init_; 125 scoped_ptr<ViewsInit> views_init_;
(...skipping 17 matching lines...) Expand all
143 keyboard_->set_target(view_id); 143 keyboard_->set_target(view_id);
144 } 144 }
145 145
146 } // namespace examples 146 } // namespace examples
147 } // namespace mojo 147 } // namespace mojo
148 148
149 MojoResult MojoMain(MojoHandle shell_handle) { 149 MojoResult MojoMain(MojoHandle shell_handle) {
150 mojo::ApplicationRunnerChromium runner(new mojo::examples::Keyboard); 150 mojo::ApplicationRunnerChromium runner(new mojo::examples::Keyboard);
151 return runner.Run(shell_handle); 151 return runner.Run(shell_handle);
152 } 152 }
OLDNEW
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/keyboard/keyboard_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698