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 "ui/views/controls/menu/menu_message_loop_aura.h" | 5 #include "ui/views/controls/menu/menu_message_loop_aura.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 : controller_(controller), root_(root) { | 54 : controller_(controller), root_(root) { |
55 aura::client::GetActivationClient(root_)->AddObserver(this); | 55 aura::client::GetActivationClient(root_)->AddObserver(this); |
56 root_->AddObserver(this); | 56 root_->AddObserver(this); |
57 root_->AddPreTargetHandler(this); | 57 root_->AddPreTargetHandler(this); |
58 } | 58 } |
59 | 59 |
60 virtual ~ActivationChangeObserverImpl() { Cleanup(); } | 60 virtual ~ActivationChangeObserverImpl() { Cleanup(); } |
61 | 61 |
62 // aura::client::ActivationChangeObserver: | 62 // aura::client::ActivationChangeObserver: |
63 virtual void OnWindowActivated(aura::Window* gained_active, | 63 virtual void OnWindowActivated(aura::Window* gained_active, |
64 aura::Window* lost_active) OVERRIDE { | 64 aura::Window* lost_active) override { |
65 if (!controller_->drag_in_progress()) | 65 if (!controller_->drag_in_progress()) |
66 controller_->CancelAll(); | 66 controller_->CancelAll(); |
67 } | 67 } |
68 | 68 |
69 // aura::WindowObserver: | 69 // aura::WindowObserver: |
70 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { Cleanup(); } | 70 virtual void OnWindowDestroying(aura::Window* window) override { Cleanup(); } |
71 | 71 |
72 // ui::EventHandler: | 72 // ui::EventHandler: |
73 virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE { | 73 virtual void OnCancelMode(ui::CancelModeEvent* event) override { |
74 controller_->CancelAll(); | 74 controller_->CancelAll(); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 void Cleanup() { | 78 void Cleanup() { |
79 if (!root_) | 79 if (!root_) |
80 return; | 80 return; |
81 // The ActivationClient may have been destroyed by the time we get here. | 81 // The ActivationClient may have been destroyed by the time we get here. |
82 aura::client::ActivationClient* client = | 82 aura::client::ActivationClient* client = |
83 aura::client::GetActivationClient(root_); | 83 aura::client::GetActivationClient(root_); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 message_loop_quit_.Run(); | 193 message_loop_quit_.Run(); |
194 // Restore the previous dispatcher. | 194 // Restore the previous dispatcher. |
195 nested_dispatcher_.reset(); | 195 nested_dispatcher_.reset(); |
196 } | 196 } |
197 | 197 |
198 void MenuMessageLoopAura::ClearOwner() { | 198 void MenuMessageLoopAura::ClearOwner() { |
199 owner_ = NULL; | 199 owner_ = NULL; |
200 } | 200 } |
201 | 201 |
202 } // namespace views | 202 } // namespace views |
OLD | NEW |