OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool is_cursor_handle) | 234 bool is_cursor_handle) |
235 : controller_(controller), | 235 : controller_(controller), |
236 image_(GetCenterHandleImage()), | 236 image_(GetCenterHandleImage()), |
237 is_cursor_handle_(is_cursor_handle), | 237 is_cursor_handle_(is_cursor_handle), |
238 draw_invisible_(false), | 238 draw_invisible_(false), |
239 weak_ptr_factory_(this) { | 239 weak_ptr_factory_(this) { |
240 widget_.reset(CreateTouchSelectionPopupWidget(context, this)); | 240 widget_.reset(CreateTouchSelectionPopupWidget(context, this)); |
241 widget_->SetContentsView(this); | 241 widget_->SetContentsView(this); |
242 | 242 |
243 aura::Window* window = widget_->GetNativeWindow(); | 243 aura::Window* window = widget_->GetNativeWindow(); |
244 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 244 window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
245 new TouchHandleWindowTargeter(window, this))); | 245 new TouchHandleWindowTargeter(window, this))); |
246 | 246 |
247 // We are owned by the TouchSelectionControllerImpl. | 247 // We are owned by the TouchSelectionControllerImpl. |
248 set_owned_by_client(); | 248 set_owned_by_client(); |
249 } | 249 } |
250 | 250 |
251 ~EditingHandleView() override { SetWidgetVisible(false, false); } | 251 ~EditingHandleView() override { SetWidgetVisible(false, false); } |
252 | 252 |
253 // Overridden from views::WidgetDelegateView: | 253 // Overridden from views::WidgetDelegateView: |
254 bool WidgetHasHitTestMask() const override { return true; } | 254 bool WidgetHasHitTestMask() const override { return true; } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 | 370 |
371 void SetDrawInvisible(bool draw_invisible) { | 371 void SetDrawInvisible(bool draw_invisible) { |
372 if (draw_invisible_ == draw_invisible) | 372 if (draw_invisible_ == draw_invisible) |
373 return; | 373 return; |
374 draw_invisible_ = draw_invisible; | 374 draw_invisible_ = draw_invisible; |
375 SchedulePaint(); | 375 SchedulePaint(); |
376 } | 376 } |
377 | 377 |
378 private: | 378 private: |
379 scoped_ptr<Widget> widget_; | 379 std::unique_ptr<Widget> widget_; |
380 TouchSelectionControllerImpl* controller_; | 380 TouchSelectionControllerImpl* controller_; |
381 | 381 |
382 // In local coordinates | 382 // In local coordinates |
383 ui::SelectionBound selection_bound_; | 383 ui::SelectionBound selection_bound_; |
384 gfx::Image* image_; | 384 gfx::Image* image_; |
385 | 385 |
386 // If true, this is a handle corresponding to the single cursor, otherwise it | 386 // If true, this is a handle corresponding to the single cursor, otherwise it |
387 // is a handle corresponding to one of the two selection bounds. | 387 // is a handle corresponding to one of the two selection bounds. |
388 bool is_cursor_handle_; | 388 bool is_cursor_handle_; |
389 | 389 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle1View() { | 772 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle1View() { |
773 return selection_handle_1_.get(); | 773 return selection_handle_1_.get(); |
774 } | 774 } |
775 | 775 |
776 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle2View() { | 776 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle2View() { |
777 return selection_handle_2_.get(); | 777 return selection_handle_2_.get(); |
778 } | 778 } |
779 | 779 |
780 } // namespace views | 780 } // namespace views |
OLD | NEW |