Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/controls/textfield/textfield_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 cursor_visible_(false), 285 cursor_visible_(false),
286 drop_cursor_visible_(false), 286 drop_cursor_visible_(false),
287 initiating_drag_(false), 287 initiating_drag_(false),
288 aggregated_clicks_(0), 288 aggregated_clicks_(0),
289 drag_start_display_offset_(0), 289 drag_start_display_offset_(0),
290 touch_handles_hidden_due_to_scroll_(false), 290 touch_handles_hidden_due_to_scroll_(false),
291 weak_ptr_factory_(this) { 291 weak_ptr_factory_(this) {
292 set_context_menu_controller(this); 292 set_context_menu_controller(this);
293 set_drag_controller(this); 293 set_drag_controller(this);
294 GetRenderText()->SetFontList(GetDefaultFontList()); 294 GetRenderText()->SetFontList(GetDefaultFontList());
295 SetBorder(scoped_ptr<Border>(new FocusableBorder())); 295 SetBorder(std::unique_ptr<Border>(new FocusableBorder()));
296 SetFocusable(true); 296 SetFocusable(true);
297 297
298 if (ViewsDelegate::GetInstance()) { 298 if (ViewsDelegate::GetInstance()) {
299 password_reveal_duration_ = 299 password_reveal_duration_ =
300 ViewsDelegate::GetInstance() 300 ViewsDelegate::GetInstance()
301 ->GetDefaultTextfieldObscuredRevealDuration(); 301 ->GetDefaultTextfieldObscuredRevealDuration();
302 } 302 }
303 303
304 // These allow BrowserView to pass edit commands from the Chrome menu to us 304 // These allow BrowserView to pass edit commands from the Chrome menu to us
305 // when we're focused by simply asking the FocusManager to 305 // when we're focused by simply asking the FocusManager to
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } 565 }
566 566
567 void Textfield::SetAccessibleName(const base::string16& name) { 567 void Textfield::SetAccessibleName(const base::string16& name) {
568 accessible_name_ = name; 568 accessible_name_ = name;
569 } 569 }
570 570
571 void Textfield::ExecuteCommand(int command_id) { 571 void Textfield::ExecuteCommand(int command_id) {
572 ExecuteCommand(command_id, ui::EF_NONE); 572 ExecuteCommand(command_id, ui::EF_NONE);
573 } 573 }
574 574
575 void Textfield::SetFocusPainter(scoped_ptr<Painter> focus_painter) { 575 void Textfield::SetFocusPainter(std::unique_ptr<Painter> focus_painter) {
576 focus_painter_ = std::move(focus_painter); 576 focus_painter_ = std::move(focus_painter);
577 } 577 }
578 578
579 bool Textfield::HasTextBeingDragged() { 579 bool Textfield::HasTextBeingDragged() {
580 return initiating_drag_; 580 return initiating_drag_;
581 } 581 }
582 582
583 //////////////////////////////////////////////////////////////////////////////// 583 ////////////////////////////////////////////////////////////////////////////////
584 // Textfield, View overrides: 584 // Textfield, View overrides:
585 585
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 data->SetString(selected_text); 1095 data->SetString(selected_text);
1096 Label label(selected_text, GetFontList()); 1096 Label label(selected_text, GetFontList());
1097 label.SetBackgroundColor(GetBackgroundColor()); 1097 label.SetBackgroundColor(GetBackgroundColor());
1098 label.SetSubpixelRenderingEnabled(false); 1098 label.SetSubpixelRenderingEnabled(false);
1099 gfx::Size size(label.GetPreferredSize()); 1099 gfx::Size size(label.GetPreferredSize());
1100 gfx::NativeView native_view = GetWidget()->GetNativeView(); 1100 gfx::NativeView native_view = GetWidget()->GetNativeView();
1101 gfx::Display display = 1101 gfx::Display display =
1102 gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view); 1102 gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view);
1103 size.SetToMin(gfx::Size(display.size().width(), height())); 1103 size.SetToMin(gfx::Size(display.size().width(), height()));
1104 label.SetBoundsRect(gfx::Rect(size)); 1104 label.SetBoundsRect(gfx::Rect(size));
1105 scoped_ptr<gfx::Canvas> canvas( 1105 std::unique_ptr<gfx::Canvas> canvas(
1106 GetCanvasForDragImage(GetWidget(), label.size())); 1106 GetCanvasForDragImage(GetWidget(), label.size()));
1107 label.SetEnabledColor(GetTextColor()); 1107 label.SetEnabledColor(GetTextColor());
1108 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1108 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1109 // Desktop Linux Aura does not yet support transparency in drag images. 1109 // Desktop Linux Aura does not yet support transparency in drag images.
1110 canvas->DrawColor(GetBackgroundColor()); 1110 canvas->DrawColor(GetBackgroundColor());
1111 #endif 1111 #endif
1112 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context()); 1112 label.Paint(ui::CanvasPainter(canvas.get(), 1.f).context());
1113 const gfx::Vector2d kOffset(-15, 0); 1113 const gfx::Vector2d kOffset(-15, 0);
1114 drag_utils::SetDragImageOnDataObject(*canvas, kOffset, data); 1114 drag_utils::SetDragImageOnDataObject(*canvas, kOffset, data);
1115 if (controller_) 1115 if (controller_)
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 RequestFocus(); 1901 RequestFocus();
1902 model_->MoveCursorTo(mouse); 1902 model_->MoveCursorTo(mouse);
1903 if (!selection_clipboard_text.empty()) { 1903 if (!selection_clipboard_text.empty()) {
1904 model_->InsertText(selection_clipboard_text); 1904 model_->InsertText(selection_clipboard_text);
1905 UpdateAfterChange(true, true); 1905 UpdateAfterChange(true, true);
1906 } 1906 }
1907 OnAfterUserAction(); 1907 OnAfterUserAction();
1908 } 1908 }
1909 1909
1910 } // namespace views 1910 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | ui/views/controls/textfield/textfield_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698