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

Side by Side Diff: ui/views/controls/tree/tree_view.cc

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix touch drag and drop unit test. Created 6 years, 11 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 | Annotate | Revision Log
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/tree/tree_view.h" 5 #include "ui/views/controls/tree/tree_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 197 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
198 RemoveAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 198 RemoveAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
199 } 199 }
200 200
201 void TreeView::CommitEdit() { 201 void TreeView::CommitEdit() {
202 if (!editing_) 202 if (!editing_)
203 return; 203 return;
204 204
205 DCHECK(selected_node_); 205 DCHECK(selected_node_);
206 const bool editor_has_focus = editor_->HasFocus(); 206 const bool editor_has_focus = editor_->HasFocus();
207 model_->SetTitle(GetSelectedNode(), editor_->text()); 207 model_->SetTitle(GetSelectedNode(), editor_->GetText());
208 CancelEdit(); 208 CancelEdit();
209 if (editor_has_focus) 209 if (editor_has_focus)
210 RequestFocus(); 210 RequestFocus();
211 } 211 }
212 212
213 TreeModelNode* TreeView::GetEditingNode() { 213 TreeModelNode* TreeView::GetEditingNode() {
214 return editing_ ? selected_node_->model_node() : NULL; 214 return editing_ ? selected_node_->model_node() : NULL;
215 } 215 }
216 216
217 void TreeView::SetSelectedNode(TreeModelNode* model_node) { 217 void TreeView::SetSelectedNode(TreeModelNode* model_node) {
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 if (!is_expanded_) 1036 if (!is_expanded_)
1037 return max_width; 1037 return max_width;
1038 for (int i = 0; i < child_count(); ++i) { 1038 for (int i = 0; i < child_count(); ++i) {
1039 max_width = std::max(max_width, 1039 max_width = std::max(max_width,
1040 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1040 GetChild(i)->GetMaxWidth(indent, depth + 1));
1041 } 1041 }
1042 return max_width; 1042 return max_width;
1043 } 1043 }
1044 1044
1045 } // namespace views 1045 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698