| OLD | NEW |
| 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 "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 title_tf_.SelectAll(); | 272 title_tf_.SelectAll(); |
| 273 // Give focus to the name Textfield. | 273 // Give focus to the name Textfield. |
| 274 title_tf_.RequestFocus(); | 274 title_tf_.RequestFocus(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void BookmarkEditorView::Close() { | 277 void BookmarkEditorView::Close() { |
| 278 DCHECK(GetWidget()); | 278 DCHECK(GetWidget()); |
| 279 GetWidget()->Close(); | 279 GetWidget()->Close(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void BookmarkEditorView::ShowContextMenuForView(View* source, | 282 void BookmarkEditorView::ShowContextMenuForView(views::View* source, |
| 283 const gfx::Point& p, | 283 const gfx::Point& point) { |
| 284 bool is_mouse_gesture) { | |
| 285 DCHECK(source == tree_view_); | 284 DCHECK(source == tree_view_); |
| 286 if (!tree_view_->GetSelectedNode()) | 285 if (!tree_view_->GetSelectedNode()) |
| 287 return; | 286 return; |
| 288 running_menu_for_root_ = | 287 running_menu_for_root_ = |
| 289 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == | 288 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == |
| 290 tree_model_->GetRoot()); | 289 tree_model_->GetRoot()); |
| 291 #if defined(USE_AURA) | 290 #if defined(USE_AURA) |
| 292 NOTIMPLEMENTED(); | 291 NOTIMPLEMENTED(); |
| 293 #else | 292 #else |
| 294 if (!context_menu_contents_.get()) { | 293 if (!context_menu_contents_.get()) { |
| 295 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); | 294 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); |
| 296 context_menu_contents_->AddItemWithStringId(IDS_EDIT, IDS_EDIT); | 295 context_menu_contents_->AddItemWithStringId(IDS_EDIT, IDS_EDIT); |
| 297 context_menu_contents_->AddItemWithStringId(IDS_DELETE, IDS_DELETE); | 296 context_menu_contents_->AddItemWithStringId(IDS_DELETE, IDS_DELETE); |
| 298 context_menu_contents_->AddItemWithStringId( | 297 context_menu_contents_->AddItemWithStringId( |
| 299 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM, | 298 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM, |
| 300 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); | 299 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); |
| 301 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 300 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
| 302 } | 301 } |
| 303 context_menu_->RunContextMenuAt(p); | 302 context_menu_->RunContextMenuAt(point); |
| 304 #endif | 303 #endif |
| 305 } | 304 } |
| 306 | 305 |
| 307 void BookmarkEditorView::Init() { | 306 void BookmarkEditorView::Init() { |
| 308 bb_model_ = profile_->GetBookmarkModel(); | 307 bb_model_ = profile_->GetBookmarkModel(); |
| 309 DCHECK(bb_model_); | 308 DCHECK(bb_model_); |
| 310 bb_model_->AddObserver(this); | 309 bb_model_->AddObserver(this); |
| 311 | 310 |
| 312 title_tf_.set_parent_owned(false); | 311 title_tf_.set_parent_owned(false); |
| 313 | 312 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); | 667 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); |
| 669 for (int i = 0; i < editor_node->child_count(); ++i) | 668 for (int i = 0; i < editor_node->child_count(); ++i) |
| 670 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); | 669 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); |
| 671 } | 670 } |
| 672 | 671 |
| 673 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 672 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
| 674 const string16& title) { | 673 const string16& title) { |
| 675 if (!title.empty()) | 674 if (!title.empty()) |
| 676 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 675 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 677 } | 676 } |
| OLD | NEW |