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

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

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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "app/tree_node_model.h" 10 #include "app/tree_node_model.h"
11 #include "chrome/browser/bookmarks/bookmark_editor.h" 11 #include "chrome/browser/bookmarks/bookmark_editor.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "views/controls/button/button.h" 13 #include "views/controls/button/button.h"
14 #include "views/controls/menu/menu.h" 14 #include "views/controls/menu/menu.h"
15 #include "views/controls/text_field.h" 15 #include "views/controls/textfield/textfield.h"
16 #include "views/controls/tree/tree_view.h" 16 #include "views/controls/tree/tree_view.h"
17 #include "views/window/dialog_delegate.h" 17 #include "views/window/dialog_delegate.h"
18 18
19 namespace views { 19 namespace views {
20 class NativeButton; 20 class NativeButton;
21 class Window; 21 class Window;
22 } 22 }
23 23
24 class GURL; 24 class GURL;
25 class Menu; 25 class Menu;
26 class Profile; 26 class Profile;
27 27
28 // View that allows the user to edit a bookmark/starred URL. The user can 28 // View that allows the user to edit a bookmark/starred URL. The user can
29 // change the URL, title and where the bookmark appears as well as adding 29 // change the URL, title and where the bookmark appears as well as adding
30 // new groups and changing the name of other groups. 30 // new groups and changing the name of other groups.
31 // 31 //
32 // Edits are applied to the BookmarkModel when the user presses 'OK'. 32 // Edits are applied to the BookmarkModel when the user presses 'OK'.
33 // 33 //
34 // To use BookmarkEditorView invoke the static show method. 34 // To use BookmarkEditorView invoke the static show method.
35 35
36 class BookmarkEditorView : public BookmarkEditor, 36 class BookmarkEditorView : public BookmarkEditor,
37 public views::View, 37 public views::View,
38 public views::ButtonListener, 38 public views::ButtonListener,
39 public views::TreeViewController, 39 public views::TreeViewController,
40 public views::DialogDelegate, 40 public views::DialogDelegate,
41 public views::TextField::Controller, 41 public views::Textfield::Controller,
42 public views::ContextMenuController, 42 public views::ContextMenuController,
43 public views::Menu::Delegate, 43 public views::Menu::Delegate,
44 public BookmarkModelObserver { 44 public BookmarkModelObserver {
45 FRIEND_TEST(BookmarkEditorViewTest, ChangeParent); 45 FRIEND_TEST(BookmarkEditorViewTest, ChangeParent);
46 FRIEND_TEST(BookmarkEditorViewTest, ChangeParentAndURL); 46 FRIEND_TEST(BookmarkEditorViewTest, ChangeParentAndURL);
47 FRIEND_TEST(BookmarkEditorViewTest, ChangeURLToExistingURL); 47 FRIEND_TEST(BookmarkEditorViewTest, ChangeURLToExistingURL);
48 FRIEND_TEST(BookmarkEditorViewTest, EditTitleKeepsPosition); 48 FRIEND_TEST(BookmarkEditorViewTest, EditTitleKeepsPosition);
49 FRIEND_TEST(BookmarkEditorViewTest, EditURLKeepsPosition); 49 FRIEND_TEST(BookmarkEditorViewTest, EditURLKeepsPosition);
50 FRIEND_TEST(BookmarkEditorViewTest, ModelsMatch); 50 FRIEND_TEST(BookmarkEditorViewTest, ModelsMatch);
51 FRIEND_TEST(BookmarkEditorViewTest, MoveToNewParent); 51 FRIEND_TEST(BookmarkEditorViewTest, MoveToNewParent);
(...skipping 21 matching lines...) Expand all
73 // View methods. 73 // View methods.
74 virtual void Layout(); 74 virtual void Layout();
75 virtual gfx::Size GetPreferredSize(); 75 virtual gfx::Size GetPreferredSize();
76 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, 76 virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
77 views::View* child); 77 views::View* child);
78 78
79 // TreeViewObserver methods. 79 // TreeViewObserver methods.
80 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); 80 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
81 virtual bool CanEdit(views::TreeView* tree_view, TreeModelNode* node); 81 virtual bool CanEdit(views::TreeView* tree_view, TreeModelNode* node);
82 82
83 // TextField::Controller methods. 83 // Textfield::Controller methods.
84 virtual void ContentsChanged(views::TextField* sender, 84 virtual void ContentsChanged(views::Textfield* sender,
85 const std::wstring& new_contents); 85 const std::wstring& new_contents);
86 virtual bool HandleKeystroke(views::TextField* sender, 86 virtual bool HandleKeystroke(views::Textfield* sender,
87 const views::TextField::Keystroke&) { 87 const views::Textfield::Keystroke&) {
88 return false; 88 return false;
89 } 89 }
90 90
91 // NativeButton. 91 // NativeButton.
92 virtual void ButtonPressed(views::Button* sender); 92 virtual void ButtonPressed(views::Button* sender);
93 93
94 // Menu::Delegate method. 94 // Menu::Delegate method.
95 virtual void ExecuteCommand(int id); 95 virtual void ExecuteCommand(int id);
96 96
97 // Menu::Delegate method, return false if id is edit and the bookmark node 97 // Menu::Delegate method, return false if id is edit and the bookmark node
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 BookmarkEditorView::EditorNode* parent_b_node, 199 BookmarkEditorView::EditorNode* parent_b_node,
200 BookmarkNode** parent_bb_node); 200 BookmarkNode** parent_bb_node);
201 201
202 // Returns the current url the user has input. 202 // Returns the current url the user has input.
203 GURL GetInputURL() const; 203 GURL GetInputURL() const;
204 204
205 // Returns the title the user has input. 205 // Returns the title the user has input.
206 std::wstring GetInputTitle() const; 206 std::wstring GetInputTitle() const;
207 207
208 // Invoked when the url or title has possibly changed. Updates the background 208 // Invoked when the url or title has possibly changed. Updates the background
209 // of textfields and ok button appropriately. 209 // of Textfields and ok button appropriately.
210 void UserInputChanged(); 210 void UserInputChanged();
211 211
212 // Creates a new group as a child of the selected node. If no node is 212 // Creates a new group as a child of the selected node. If no node is
213 // selected, the new group is added as a child of the bookmark node. Starts 213 // selected, the new group is added as a child of the bookmark node. Starts
214 // editing on the new gorup as well. 214 // editing on the new gorup as well.
215 void NewGroup(); 215 void NewGroup();
216 216
217 // Creates a new EditorNode as the last child of parent. The new node is 217 // Creates a new EditorNode as the last child of parent. The new node is
218 // added to the model and returned. This does NOT start editing. This is used 218 // added to the model and returned. This does NOT start editing. This is used
219 // internally by NewGroup and broken into a separate method for testing. 219 // internally by NewGroup and broken into a separate method for testing.
220 EditorNode* AddNewGroup(EditorNode* parent); 220 EditorNode* AddNewGroup(EditorNode* parent);
221 221
222 // Profile the entry is from. 222 // Profile the entry is from.
223 Profile* profile_; 223 Profile* profile_;
224 224
225 // Model driving the TreeView. 225 // Model driving the TreeView.
226 scoped_ptr<EditorTreeModel> tree_model_; 226 scoped_ptr<EditorTreeModel> tree_model_;
227 227
228 // Displays star groups. 228 // Displays star groups.
229 views::TreeView* tree_view_; 229 views::TreeView* tree_view_;
230 230
231 // Used to create a new group. 231 // Used to create a new group.
232 scoped_ptr<views::NativeButton> new_group_button_; 232 scoped_ptr<views::NativeButton> new_group_button_;
233 233
234 // Used for editing the URL. 234 // Used for editing the URL.
235 views::TextField url_tf_; 235 views::Textfield url_tf_;
236 236
237 // Used for editing the title. 237 // Used for editing the title.
238 views::TextField title_tf_; 238 views::Textfield title_tf_;
239 239
240 // Initial parent to select. Is only used if node_ is NULL. 240 // Initial parent to select. Is only used if node_ is NULL.
241 BookmarkNode* parent_; 241 BookmarkNode* parent_;
242 242
243 // Node being edited. Is NULL if creating a new node. 243 // Node being edited. Is NULL if creating a new node.
244 BookmarkNode* node_; 244 BookmarkNode* node_;
245 245
246 // The context menu. 246 // The context menu.
247 scoped_ptr<views::Menu> context_menu_; 247 scoped_ptr<views::Menu> context_menu_;
248 248
249 // Mode used to create nodes from. 249 // Mode used to create nodes from.
250 BookmarkModel* bb_model_; 250 BookmarkModel* bb_model_;
251 251
252 // If true, we're running the menu for the bookmark bar or other bookmarks 252 // If true, we're running the menu for the bookmark bar or other bookmarks
253 // nodes. 253 // nodes.
254 bool running_menu_for_root_; 254 bool running_menu_for_root_;
255 255
256 // Is the tree shown? 256 // Is the tree shown?
257 bool show_tree_; 257 bool show_tree_;
258 258
259 scoped_ptr<BookmarkEditor::Handler> handler_; 259 scoped_ptr<BookmarkEditor::Handler> handler_;
260 260
261 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); 261 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView);
262 }; 262 };
263 263
264 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ 264 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_bubble_view.cc ('k') | chrome/browser/views/bookmark_editor_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698