| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/button/button.h" | 5 #include "views/controls/button/button.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 | 7 |
| 8 namespace views { | 8 namespace views { |
| 9 | 9 |
| 10 //////////////////////////////////////////////////////////////////////////////// | 10 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Button, protected: | 45 // Button, protected: |
| 46 | 46 |
| 47 Button::Button(ButtonListener* listener) | 47 Button::Button(ButtonListener* listener) |
| 48 : listener_(listener), | 48 : listener_(listener), |
| 49 tag_(-1), | 49 tag_(-1), |
| 50 mouse_event_flags_(0) { | 50 mouse_event_flags_(0) { |
| 51 set_accessibility_focusable(true); | 51 set_accessibility_focusable(true); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void Button::NotifyClick(const views::Event& event) { | 54 void Button::NotifyClick(const views::Event& event) { |
| 55 mouse_event_flags_ = event.IsMouseEvent() ? event.GetFlags() : 0; | 55 mouse_event_flags_ = event.IsMouseEvent() ? event.flags() : 0; |
| 56 // We can be called when there is no listener, in cases like double clicks on | 56 // We can be called when there is no listener, in cases like double clicks on |
| 57 // menu buttons etc. | 57 // menu buttons etc. |
| 58 if (listener_) | 58 if (listener_) |
| 59 listener_->ButtonPressed(this, event); | 59 listener_->ButtonPressed(this, event); |
| 60 // NOTE: don't attempt to reset mouse_event_flags_ as the listener may have | 60 // NOTE: don't attempt to reset mouse_event_flags_ as the listener may have |
| 61 // deleted us. | 61 // deleted us. |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace views | 64 } // namespace views |
| OLD | NEW |