OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/touchui/touch_selection_menu_runner_views.h" | 5 #include "ui/views/touchui/touch_selection_menu_runner_views.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Draw separator bars. | 188 // Draw separator bars. |
189 for (int i = 0; i < child_count() - 1; ++i) { | 189 for (int i = 0; i < child_count() - 1; ++i) { |
190 View* child = child_at(i); | 190 View* child = child_at(i); |
191 int x = child->bounds().right() + kSpacingBetweenButtons / 2; | 191 int x = child->bounds().right() + kSpacingBetweenButtons / 2; |
192 canvas->FillRect(gfx::Rect(x, 0, 1, child->height()), | 192 canvas->FillRect(gfx::Rect(x, 0, 1, child->height()), |
193 kButtonSeparatorColor); | 193 kButtonSeparatorColor); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 void TouchSelectionMenuRunnerViews::Menu::WindowClosing() { | 197 void TouchSelectionMenuRunnerViews::Menu::WindowClosing() { |
198 DCHECK_IMPLIES(owner_, owner_->menu_ == this); | 198 DCHECK(!owner_ || owner_->menu_ == this); |
199 BubbleDelegateView::WindowClosing(); | 199 BubbleDelegateView::WindowClosing(); |
200 if (owner_) | 200 if (owner_) |
201 owner_->menu_ = nullptr; | 201 owner_->menu_ = nullptr; |
202 } | 202 } |
203 | 203 |
204 void TouchSelectionMenuRunnerViews::Menu::ButtonPressed( | 204 void TouchSelectionMenuRunnerViews::Menu::ButtonPressed( |
205 Button* sender, | 205 Button* sender, |
206 const ui::Event& event) { | 206 const ui::Event& event) { |
207 Close(); | 207 Close(); |
208 if (sender->tag() != kEllipsesButtonTag) | 208 if (sender->tag() != kEllipsesButtonTag) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Closing the menu will eventually delete the object. | 240 // Closing the menu will eventually delete the object. |
241 menu_->Close(); | 241 menu_->Close(); |
242 menu_ = nullptr; | 242 menu_ = nullptr; |
243 } | 243 } |
244 | 244 |
245 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 245 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
246 return menu_ != nullptr; | 246 return menu_ != nullptr; |
247 } | 247 } |
248 | 248 |
249 } // namespace views | 249 } // namespace views |
OLD | NEW |