| 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 "content/shell/browser/shell_platform_data_aura.h" | 5 #include "content/shell/browser/shell_platform_data_aura.h" |
| 6 | 6 |
| 7 #include "content/shell/browser/shell.h" | 7 #include "content/shell/browser/shell.h" |
| 8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura/client/default_capture_client.h" | 9 #include "ui/aura/client/default_capture_client.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class FillLayout : public aura::LayoutManager { | 26 class FillLayout : public aura::LayoutManager { |
| 27 public: | 27 public: |
| 28 explicit FillLayout(aura::Window* root) | 28 explicit FillLayout(aura::Window* root) |
| 29 : root_(root) { | 29 : root_(root) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual ~FillLayout() {} | 32 virtual ~FillLayout() {} |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // aura::LayoutManager: | 35 // aura::LayoutManager: |
| 36 virtual void OnWindowResized() OVERRIDE { | 36 virtual void OnWindowResized() override { |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { | 39 virtual void OnWindowAddedToLayout(aura::Window* child) override { |
| 40 child->SetBounds(root_->bounds()); | 40 child->SetBounds(root_->bounds()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE { | 43 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override { |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE { | 46 virtual void OnWindowRemovedFromLayout(aura::Window* child) override { |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 49 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 50 bool visible) OVERRIDE { | 50 bool visible) override { |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void SetChildBounds(aura::Window* child, | 53 virtual void SetChildBounds(aura::Window* child, |
| 54 const gfx::Rect& requested_bounds) OVERRIDE { | 54 const gfx::Rect& requested_bounds) override { |
| 55 SetChildBoundsDirect(child, requested_bounds); | 55 SetChildBoundsDirect(child, requested_bounds); |
| 56 } | 56 } |
| 57 | 57 |
| 58 aura::Window* root_; | 58 aura::Window* root_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(FillLayout); | 60 DISALLOW_COPY_AND_ASSIGN(FillLayout); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, | 63 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, |
| 64 public ui::EventHandler { | 64 public ui::EventHandler { |
| 65 public: | 65 public: |
| 66 explicit MinimalInputEventFilter(aura::WindowTreeHost* host) | 66 explicit MinimalInputEventFilter(aura::WindowTreeHost* host) |
| 67 : host_(host), | 67 : host_(host), |
| 68 input_method_(ui::CreateInputMethod(this, | 68 input_method_(ui::CreateInputMethod(this, |
| 69 gfx::kNullAcceleratedWidget)) { | 69 gfx::kNullAcceleratedWidget)) { |
| 70 input_method_->Init(true); | 70 input_method_->Init(true); |
| 71 host_->window()->AddPreTargetHandler(this); | 71 host_->window()->AddPreTargetHandler(this); |
| 72 host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey, | 72 host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey, |
| 73 input_method_.get()); | 73 input_method_.get()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual ~MinimalInputEventFilter() { | 76 virtual ~MinimalInputEventFilter() { |
| 77 host_->window()->RemovePreTargetHandler(this); | 77 host_->window()->RemovePreTargetHandler(this); |
| 78 host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey, | 78 host_->window()->SetProperty(aura::client::kRootWindowInputMethodKey, |
| 79 static_cast<ui::InputMethod*>(NULL)); | 79 static_cast<ui::InputMethod*>(NULL)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // ui::EventHandler: | 83 // ui::EventHandler: |
| 84 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { | 84 virtual void OnKeyEvent(ui::KeyEvent* event) override { |
| 85 // See the comment in InputMethodEventFilter::OnKeyEvent() for details. | 85 // See the comment in InputMethodEventFilter::OnKeyEvent() for details. |
| 86 if (event->IsTranslated()) { | 86 if (event->IsTranslated()) { |
| 87 event->SetTranslated(false); | 87 event->SetTranslated(false); |
| 88 } else { | 88 } else { |
| 89 if (input_method_->DispatchKeyEvent(*event)) | 89 if (input_method_->DispatchKeyEvent(*event)) |
| 90 event->StopPropagation(); | 90 event->StopPropagation(); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 // ui::internal::InputMethodDelegate: | 94 // ui::internal::InputMethodDelegate: |
| 95 virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE { | 95 virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { |
| 96 // See the comment in InputMethodEventFilter::DispatchKeyEventPostIME() for | 96 // See the comment in InputMethodEventFilter::DispatchKeyEventPostIME() for |
| 97 // details. | 97 // details. |
| 98 ui::KeyEvent aura_event(event); | 98 ui::KeyEvent aura_event(event); |
| 99 aura_event.SetTranslated(true); | 99 aura_event.SetTranslated(true); |
| 100 ui::EventDispatchDetails details = | 100 ui::EventDispatchDetails details = |
| 101 host_->dispatcher()->OnEventFromSource(&aura_event); | 101 host_->dispatcher()->OnEventFromSource(&aura_event); |
| 102 return aura_event.handled() || details.dispatcher_destroyed; | 102 return aura_event.handled() || details.dispatcher_destroyed; |
| 103 } | 103 } |
| 104 | 104 |
| 105 aura::WindowTreeHost* host_; | 105 aura::WindowTreeHost* host_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 134 | 134 |
| 135 void ShellPlatformDataAura::ShowWindow() { | 135 void ShellPlatformDataAura::ShowWindow() { |
| 136 host_->Show(); | 136 host_->Show(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void ShellPlatformDataAura::ResizeWindow(const gfx::Size& size) { | 139 void ShellPlatformDataAura::ResizeWindow(const gfx::Size& size) { |
| 140 host_->SetBounds(gfx::Rect(size)); | 140 host_->SetBounds(gfx::Rect(size)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace content | 143 } // namespace content |
| OLD | NEW |