| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "mojo/examples/aura_demo/demo_screen.h" | 15 #include "mojo/examples/aura_demo/demo_screen.h" |
| 16 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" | 16 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" |
| 17 #include "mojo/examples/launcher/launcher.mojom.h" | 17 #include "mojo/examples/launcher/launcher.mojom.h" |
| 18 #include "mojo/public/cpp/bindings/allocation_scope.h" | 18 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| 19 #include "mojo/public/cpp/bindings/remote_ptr.h" | 19 #include "mojo/public/cpp/bindings/remote_ptr.h" |
| 20 #include "mojo/public/cpp/gles2/gles2.h" | 20 #include "mojo/public/cpp/gles2/gles2.h" |
| 21 #include "mojo/public/cpp/shell/application.h" | 21 #include "mojo/public/cpp/shell/application.h" |
| 22 #include "mojo/public/cpp/system/core.h" | 22 #include "mojo/public/cpp/system/core.h" |
| 23 #include "mojo/public/interfaces/shell/shell.mojom.h" | 23 #include "mojo/public/interfaces/shell/shell.mojom.h" |
| 24 #include "mojo/services/native_viewport/native_viewport.mojom.h" | 24 #include "mojo/services/native_viewport/native_viewport.mojom.h" |
| 25 #include "ui/aura/client/aura_constants.h" | 25 #include "ui/aura/client/aura_constants.h" |
| 26 #include "ui/aura/client/default_activation_client.h" |
| 26 #include "ui/aura/client/default_capture_client.h" | 27 #include "ui/aura/client/default_capture_client.h" |
| 27 #include "ui/aura/client/window_tree_client.h" | 28 #include "ui/aura/client/window_tree_client.h" |
| 28 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
| 29 #include "ui/aura/test/test_focus_client.h" | 30 #include "ui/aura/test/test_focus_client.h" |
| 30 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
| 31 #include "ui/aura/window_delegate.h" | 32 #include "ui/aura/window_delegate.h" |
| 32 #include "ui/aura/window_event_dispatcher.h" | 33 #include "ui/aura/window_event_dispatcher.h" |
| 33 #include "ui/aura/window_tree_host.h" | 34 #include "ui/aura/window_tree_host.h" |
| 34 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 35 #include "ui/base/ime/input_method.h" | 36 #include "ui/base/ime/input_method.h" |
| 36 #include "ui/base/ime/input_method_delegate.h" | 37 #include "ui/base/ime/input_method_delegate.h" |
| 37 #include "ui/base/ime/input_method_factory.h" | 38 #include "ui/base/ime/input_method_factory.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "ui/gfx/canvas.h" | 40 #include "ui/gfx/canvas.h" |
| 40 #include "ui/views/background.h" | 41 #include "ui/views/background.h" |
| 41 #include "ui/views/border.h" | 42 #include "ui/views/border.h" |
| 42 #include "ui/views/controls/textfield/textfield.h" | 43 #include "ui/views/controls/textfield/textfield.h" |
| 43 #include "ui/views/controls/textfield/textfield_controller.h" | 44 #include "ui/views/controls/textfield/textfield_controller.h" |
| 44 #include "ui/views/layout/fill_layout.h" | 45 #include "ui/views/layout/fill_layout.h" |
| 45 #include "ui/views/view.h" | 46 #include "ui/views/view.h" |
| 46 #include "ui/views/widget/widget.h" | 47 #include "ui/views/widget/widget.h" |
| 47 #include "ui/wm/core/default_activation_client.h" | |
| 48 #include "url/gurl.h" | 48 #include "url/gurl.h" |
| 49 | 49 |
| 50 #if defined(WIN32) | 50 #if defined(WIN32) |
| 51 #if !defined(CDECL) | 51 #if !defined(CDECL) |
| 52 #define CDECL __cdecl | 52 #define CDECL __cdecl |
| 53 #endif | 53 #endif |
| 54 #define LAUNCHER_EXPORT __declspec(dllexport) | 54 #define LAUNCHER_EXPORT __declspec(dllexport) |
| 55 #else | 55 #else |
| 56 #define CDECL | 56 #define CDECL |
| 57 #define LAUNCHER_EXPORT __attribute__((visibility("default"))) | 57 #define LAUNCHER_EXPORT __attribute__((visibility("default"))) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 launcher_client_->OnURLEntered(url_text); | 237 launcher_client_->OnURLEntered(url_text); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void HostContextCreated() { | 240 void HostContextCreated() { |
| 241 window_tree_host_->InitHost(); | 241 window_tree_host_->InitHost(); |
| 242 window_tree_host_->window()->SetBounds(gfx::Rect(450, 60)); | 242 window_tree_host_->window()->SetBounds(gfx::Rect(450, 60)); |
| 243 | 243 |
| 244 focus_client_.reset(new aura::test::TestFocusClient()); | 244 focus_client_.reset(new aura::test::TestFocusClient()); |
| 245 aura::client::SetFocusClient(window_tree_host_->window(), | 245 aura::client::SetFocusClient(window_tree_host_->window(), |
| 246 focus_client_.get()); | 246 focus_client_.get()); |
| 247 new wm::DefaultActivationClient(window_tree_host_->window()); | 247 activation_client_.reset( |
| 248 new aura::client::DefaultActivationClient(window_tree_host_->window())); |
| 248 capture_client_.reset( | 249 capture_client_.reset( |
| 249 new aura::client::DefaultCaptureClient(window_tree_host_->window())); | 250 new aura::client::DefaultCaptureClient(window_tree_host_->window())); |
| 250 ime_filter_.reset(new MinimalInputEventFilter(window_tree_host_->window())); | 251 ime_filter_.reset(new MinimalInputEventFilter(window_tree_host_->window())); |
| 251 | 252 |
| 252 window_tree_client_.reset( | 253 window_tree_client_.reset( |
| 253 new LauncherWindowTreeClient(window_tree_host_->window())); | 254 new LauncherWindowTreeClient(window_tree_host_->window())); |
| 254 | 255 |
| 255 launcher_controller_.InitInWindow(window_tree_host_->window()); | 256 launcher_controller_.InitInWindow(window_tree_host_->window()); |
| 256 | 257 |
| 257 if (pending_show_) { | 258 if (pending_show_) { |
| 258 pending_show_ = false; | 259 pending_show_ = false; |
| 259 Show(); | 260 Show(); |
| 260 } | 261 } |
| 261 } | 262 } |
| 262 | 263 |
| 263 scoped_ptr<DemoScreen> screen_; | 264 scoped_ptr<DemoScreen> screen_; |
| 264 scoped_ptr<LauncherWindowTreeClient> window_tree_client_; | 265 scoped_ptr<LauncherWindowTreeClient> window_tree_client_; |
| 266 scoped_ptr<aura::client::DefaultActivationClient> activation_client_; |
| 265 scoped_ptr<aura::client::FocusClient> focus_client_; | 267 scoped_ptr<aura::client::FocusClient> focus_client_; |
| 266 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 268 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 267 scoped_ptr<ui::EventHandler> ime_filter_; | 269 scoped_ptr<ui::EventHandler> ime_filter_; |
| 268 | 270 |
| 269 LauncherController launcher_controller_; | 271 LauncherController launcher_controller_; |
| 270 | 272 |
| 271 RemotePtr<LauncherClient> launcher_client_; | 273 RemotePtr<LauncherClient> launcher_client_; |
| 272 scoped_ptr<aura::WindowTreeHost> window_tree_host_; | 274 scoped_ptr<aura::WindowTreeHost> window_tree_host_; |
| 273 | 275 |
| 274 bool pending_show_; | 276 bool pending_show_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 294 | 296 |
| 295 // TODO(beng): This crashes in a DCHECK on X11 because this thread's | 297 // TODO(beng): This crashes in a DCHECK on X11 because this thread's |
| 296 // MessageLoop is not of TYPE_UI. I think we need a way to build | 298 // MessageLoop is not of TYPE_UI. I think we need a way to build |
| 297 // Aura that doesn't define platform-specific stuff. | 299 // Aura that doesn't define platform-specific stuff. |
| 298 aura::Env::CreateInstance(); | 300 aura::Env::CreateInstance(); |
| 299 mojo::examples::LauncherImpl launcher(shell_handle); | 301 mojo::examples::LauncherImpl launcher(shell_handle); |
| 300 loop.Run(); | 302 loop.Run(); |
| 301 | 303 |
| 302 return MOJO_RESULT_OK; | 304 return MOJO_RESULT_OK; |
| 303 } | 305 } |
| OLD | NEW |