Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_runner.h" | 5 #include "ui/views/controls/menu/menu_runner.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "ui/views/controls/button/menu_button.h" | 10 #include "ui/views/controls/button/menu_button.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 display_change_listener_.reset( | 334 display_change_listener_.reset( |
| 335 internal::DisplayChangeListener::Create(parent, this)); | 335 internal::DisplayChangeListener::Create(parent, this)); |
| 336 } | 336 } |
| 337 if ((types & MenuRunner::CONTEXT_MENU) && | 337 if ((types & MenuRunner::CONTEXT_MENU) && |
| 338 parent && | 338 parent && |
| 339 parent->GetCurrentEvent() && | 339 parent->GetCurrentEvent() && |
| 340 !MenuItemView::IsBubble(anchor)) | 340 !MenuItemView::IsBubble(anchor)) |
| 341 anchor = parent->GetCurrentEvent()->IsGestureEvent() ? | 341 anchor = parent->GetCurrentEvent()->IsGestureEvent() ? |
| 342 MenuItemView::BOTTOMCENTER : MenuItemView::TOPLEFT; | 342 MenuItemView::BOTTOMCENTER : MenuItemView::TOPLEFT; |
| 343 | 343 |
| 344 // If we are shown on mouse press, we will eat the subsequent mouse down and | |
| 345 // the parent widget will not be able to reset its state (it might have mouse | |
| 346 // capture from the mouse down). So we clear its state here. | |
| 347 if (parent && parent->GetRootView()) | |
| 348 parent->GetRootView()->SetMouseHandler(NULL); | |
|
sky
2013/03/20 21:35:53
This means a view isn't going to get a mouse exite
varunjain
2013/03/20 22:05:52
SetMouseHandler(NULL) does not reset the mouse_mov
| |
| 349 | |
| 344 return holder_->RunMenuAt(parent, button, bounds, anchor, types); | 350 return holder_->RunMenuAt(parent, button, bounds, anchor, types); |
| 345 } | 351 } |
| 346 | 352 |
| 347 bool MenuRunner::IsRunning() const { | 353 bool MenuRunner::IsRunning() const { |
| 348 return holder_->running(); | 354 return holder_->running(); |
| 349 } | 355 } |
| 350 | 356 |
| 351 void MenuRunner::Cancel() { | 357 void MenuRunner::Cancel() { |
| 352 holder_->Cancel(); | 358 holder_->Cancel(); |
| 353 } | 359 } |
| 354 | 360 |
| 355 base::TimeDelta MenuRunner::closing_event_time() const { | 361 base::TimeDelta MenuRunner::closing_event_time() const { |
| 356 return holder_->closing_event_time(); | 362 return holder_->closing_event_time(); |
| 357 } | 363 } |
| 358 | 364 |
| 359 } // namespace views | 365 } // namespace views |
| OLD | NEW |