| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 event_generator_->ReleaseKey(key_code, flags); | 235 event_generator_->ReleaseKey(key_code, flags); |
| 236 } | 236 } |
| 237 | 237 |
| 238 View* GetFocusedView() { | 238 View* GetFocusedView() { |
| 239 return widget_->GetFocusManager()->GetFocusedView(); | 239 return widget_->GetFocusManager()->GetFocusedView(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void PerformMousePress(const gfx::Point& point) { | 242 void PerformMousePress(const gfx::Point& point) { |
| 243 ui::MouseEvent pressed_event = ui::MouseEvent( | 243 ui::MouseEvent pressed_event = ui::MouseEvent( |
| 244 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), | 244 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
| 245 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 245 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 246 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 246 widget_->OnMouseEvent(&pressed_event); | 247 widget_->OnMouseEvent(&pressed_event); |
| 247 } | 248 } |
| 248 | 249 |
| 249 void PerformMouseRelease(const gfx::Point& point) { | 250 void PerformMouseRelease(const gfx::Point& point) { |
| 250 ui::MouseEvent released_event = ui::MouseEvent( | 251 ui::MouseEvent released_event = ui::MouseEvent( |
| 251 ui::ET_MOUSE_RELEASED, point, point, ui::EventTimeForNow(), | 252 ui::ET_MOUSE_RELEASED, point, point, ui::EventTimeForNow(), |
| 252 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 253 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 254 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 253 widget_->OnMouseEvent(&released_event); | 255 widget_->OnMouseEvent(&released_event); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void PerformClick(const gfx::Point& point) { | 258 void PerformClick(const gfx::Point& point) { |
| 257 PerformMousePress(point); | 259 PerformMousePress(point); |
| 258 PerformMouseRelease(point); | 260 PerformMouseRelease(point); |
| 259 } | 261 } |
| 260 | 262 |
| 261 // We need widget to populate wrapper class. | 263 // We need widget to populate wrapper class. |
| 262 Widget* widget_ = nullptr; | 264 Widget* widget_ = nullptr; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); | 918 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); |
| 917 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); | 919 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); |
| 918 | 920 |
| 919 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); | 921 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); |
| 920 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); | 922 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); |
| 921 EXPECT_FALSE(menu_model->IsVisibleAt(0)); | 923 EXPECT_FALSE(menu_model->IsVisibleAt(0)); |
| 922 EXPECT_TRUE(menu_model->IsVisibleAt(1)); | 924 EXPECT_TRUE(menu_model->IsVisibleAt(1)); |
| 923 } | 925 } |
| 924 | 926 |
| 925 } // namespace views | 927 } // namespace views |
| OLD | NEW |