| 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 "mojo/services/window_manager/window_manager_app.h" | 5 #include "mojo/services/window_manager/window_manager_app.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "mojo/aura/aura_init.h" | 9 #include "mojo/aura/aura_init.h" |
| 10 #include "mojo/converters/input_events/input_events_type_converters.h" | 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // The aura::Windows we use to track Views don't render, so we don't actually | 28 // The aura::Windows we use to track Views don't render, so we don't actually |
| 29 // need to supply a fully functional WindowDelegate. We do need to provide _a_ | 29 // need to supply a fully functional WindowDelegate. We do need to provide _a_ |
| 30 // delegate however, otherwise the event dispatcher won't dispatch events to | 30 // delegate however, otherwise the event dispatcher won't dispatch events to |
| 31 // these windows. (The aura WindowTargeter won't allow a delegate-less window | 31 // these windows. (The aura WindowTargeter won't allow a delegate-less window |
| 32 // to be the target of an event, since the window delegate is considered the | 32 // to be the target of an event, since the window delegate is considered the |
| 33 // "target handler"). | 33 // "target handler"). |
| 34 class DummyDelegate : public aura::WindowDelegate { | 34 class DummyDelegate : public aura::WindowDelegate { |
| 35 public: | 35 public: |
| 36 DummyDelegate() {} | 36 DummyDelegate() {} |
| 37 virtual ~DummyDelegate() {} | 37 ~DummyDelegate() override {} |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // WindowDelegate overrides: | 40 // WindowDelegate overrides: |
| 41 virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } | 41 gfx::Size GetMinimumSize() const override { return gfx::Size(); } |
| 42 virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); } | 42 gfx::Size GetMaximumSize() const override { return gfx::Size(); } |
| 43 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 43 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 44 const gfx::Rect& new_bounds) override {} | 44 const gfx::Rect& new_bounds) override {} |
| 45 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { | 45 gfx::NativeCursor GetCursor(const gfx::Point& point) override { |
| 46 return gfx::kNullCursor; | 46 return gfx::kNullCursor; |
| 47 } | 47 } |
| 48 virtual int GetNonClientComponent(const gfx::Point& point) const override { | 48 int GetNonClientComponent(const gfx::Point& point) const override { |
| 49 return HTCAPTION; | 49 return HTCAPTION; |
| 50 } | 50 } |
| 51 virtual bool ShouldDescendIntoChildForEventHandling( | 51 bool ShouldDescendIntoChildForEventHandling( |
| 52 aura::Window* child, | 52 aura::Window* child, |
| 53 const gfx::Point& location) override { return true; } | 53 const gfx::Point& location) override { |
| 54 virtual bool CanFocus() override { return true; } | 54 return true; |
| 55 virtual void OnCaptureLost() override {} | 55 } |
| 56 virtual void OnPaint(gfx::Canvas* canvas) override {} | 56 bool CanFocus() override { return true; } |
| 57 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 57 void OnCaptureLost() override {} |
| 58 virtual void OnWindowDestroying(aura::Window* window) override {} | 58 void OnPaint(gfx::Canvas* canvas) override {} |
| 59 virtual void OnWindowDestroyed(aura::Window* window) override {} | 59 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 60 virtual void OnWindowTargetVisibilityChanged(bool visible) override {} | 60 void OnWindowDestroying(aura::Window* window) override {} |
| 61 virtual bool HasHitTestMask() const override { return false; } | 61 void OnWindowDestroyed(aura::Window* window) override {} |
| 62 virtual void GetHitTestMask(gfx::Path* mask) const override {} | 62 void OnWindowTargetVisibilityChanged(bool visible) override {} |
| 63 bool HasHitTestMask() const override { return false; } |
| 64 void GetHitTestMask(gfx::Path* mask) const override {} |
| 63 | 65 |
| 64 DISALLOW_COPY_AND_ASSIGN(DummyDelegate); | 66 DISALLOW_COPY_AND_ASSIGN(DummyDelegate); |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 namespace { | 69 namespace { |
| 68 | 70 |
| 69 DEFINE_WINDOW_PROPERTY_KEY(View*, kViewKey, NULL); | 71 DEFINE_WINDOW_PROPERTY_KEY(View*, kViewKey, NULL); |
| 70 | 72 |
| 71 Id GetIdForWindow(aura::Window* window) { | 73 Id GetIdForWindow(aura::Window* window) { |
| 72 return window ? WindowManagerApp::GetViewForWindow(window)->id() : 0; | 74 return window ? WindowManagerApp::GetViewForWindow(window)->id() : 0; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 335 } |
| 334 view->RemoveObserver(this); | 336 view->RemoveObserver(this); |
| 335 DCHECK(it != view_id_to_window_map_.end()); | 337 DCHECK(it != view_id_to_window_map_.end()); |
| 336 // Delete before we remove from map as destruction may want to look up view | 338 // Delete before we remove from map as destruction may want to look up view |
| 337 // for window. | 339 // for window. |
| 338 delete it->second; | 340 delete it->second; |
| 339 view_id_to_window_map_.erase(it); | 341 view_id_to_window_map_.erase(it); |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace mojo | 344 } // namespace mojo |
| OLD | NEW |