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

Side by Side Diff: chrome/browser/views/bookmark_editor_view.cc

Issue 115825: Move text_field.cc and rename the class to Textfield in preparation for porti... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/views/bookmark_editor_view.h" 5 #include "chrome/browser/views/bookmark_editor_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 15 matching lines...) Expand all
26 #include "views/controls/label.h" 26 #include "views/controls/label.h"
27 #include "views/standard_layout.h" 27 #include "views/standard_layout.h"
28 #include "views/widget/widget.h" 28 #include "views/widget/widget.h"
29 #include "views/window/window.h" 29 #include "views/window/window.h"
30 30
31 using views::Button; 31 using views::Button;
32 using views::ColumnSet; 32 using views::ColumnSet;
33 using views::GridLayout; 33 using views::GridLayout;
34 using views::Label; 34 using views::Label;
35 using views::NativeButton; 35 using views::NativeButton;
36 using views::TextField; 36 using views::Textfield;
37 37
38 // Background color of text field when URL is invalid. 38 // Background color of text field when URL is invalid.
39 static const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC); 39 static const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC);
40 40
41 // Preferred width of the tree. 41 // Preferred width of the tree.
42 static const int kTreeWidth = 300; 42 static const int kTreeWidth = 300;
43 43
44 // ID for various children. 44 // ID for various children.
45 static const int kNewGroupButtonID = 1002; 45 static const int kNewGroupButtonID = 1002;
46 46
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 views::TreeView* tree_view) { 163 views::TreeView* tree_view) {
164 } 164 }
165 165
166 bool BookmarkEditorView::CanEdit(views::TreeView* tree_view, 166 bool BookmarkEditorView::CanEdit(views::TreeView* tree_view,
167 TreeModelNode* node) { 167 TreeModelNode* node) {
168 // Only allow editting of children of the bookmark bar node and other node. 168 // Only allow editting of children of the bookmark bar node and other node.
169 EditorNode* bb_node = tree_model_->AsNode(node); 169 EditorNode* bb_node = tree_model_->AsNode(node);
170 return (bb_node->GetParent() && bb_node->GetParent()->GetParent()); 170 return (bb_node->GetParent() && bb_node->GetParent()->GetParent());
171 } 171 }
172 172
173 void BookmarkEditorView::ContentsChanged(TextField* sender, 173 void BookmarkEditorView::ContentsChanged(Textfield* sender,
174 const std::wstring& new_contents) { 174 const std::wstring& new_contents) {
175 UserInputChanged(); 175 UserInputChanged();
176 } 176 }
177 177
178 void BookmarkEditorView::ButtonPressed(Button* sender) { 178 void BookmarkEditorView::ButtonPressed(Button* sender) {
179 DCHECK(sender); 179 DCHECK(sender);
180 switch (sender->GetID()) { 180 switch (sender->GetID()) {
181 case kNewGroupButtonID: 181 case kNewGroupButtonID:
182 NewGroup(); 182 NewGroup();
183 break; 183 break;
(...skipping 16 matching lines...) Expand all
200 bool BookmarkEditorView::IsCommandEnabled(int id) const { 200 bool BookmarkEditorView::IsCommandEnabled(int id) const {
201 return (id != IDS_EDIT || !running_menu_for_root_); 201 return (id != IDS_EDIT || !running_menu_for_root_);
202 } 202 }
203 203
204 void BookmarkEditorView::Show(HWND parent_hwnd) { 204 void BookmarkEditorView::Show(HWND parent_hwnd) {
205 views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this); 205 views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this);
206 UserInputChanged(); 206 UserInputChanged();
207 if (show_tree_ && bb_model_->IsLoaded()) 207 if (show_tree_ && bb_model_->IsLoaded())
208 ExpandAndSelect(); 208 ExpandAndSelect();
209 window()->Show(); 209 window()->Show();
210 // Select all the text in the name textfield. 210 // Select all the text in the name Textfield.
211 title_tf_.SelectAll(); 211 title_tf_.SelectAll();
212 // Give focus to the name textfield. 212 // Give focus to the name Textfield.
213 title_tf_.RequestFocus(); 213 title_tf_.RequestFocus();
214 } 214 }
215 215
216 void BookmarkEditorView::Close() { 216 void BookmarkEditorView::Close() {
217 DCHECK(window()); 217 DCHECK(window());
218 window()->Close(); 218 window()->Close();
219 } 219 }
220 220
221 void BookmarkEditorView::ShowContextMenu(View* source, 221 void BookmarkEditorView::ShowContextMenu(View* source,
222 int x, 222 int x,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 break; 538 break;
539 } 539 }
540 } 540 }
541 DCHECK(child_bb_node); 541 DCHECK(child_bb_node);
542 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); 542 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle());
543 } 543 }
544 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, 544 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node,
545 parent_b_node, parent_bb_node); 545 parent_b_node, parent_bb_node);
546 } 546 }
547 } 547 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_editor_view.h ('k') | chrome/browser/views/bookmark_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698