| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 title_tf_->SelectAll(true); | 227 title_tf_->SelectAll(true); |
| 228 // Give focus to the name Textfield. | 228 // Give focus to the name Textfield. |
| 229 title_tf_->RequestFocus(); | 229 title_tf_->RequestFocus(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void BookmarkEditorView::Close() { | 232 void BookmarkEditorView::Close() { |
| 233 DCHECK(GetWidget()); | 233 DCHECK(GetWidget()); |
| 234 GetWidget()->Close(); | 234 GetWidget()->Close(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void BookmarkEditorView::ShowContextMenuForView(views::View* source, | 237 void BookmarkEditorView::ShowContextMenuForView( |
| 238 const gfx::Point& point) { | 238 views::View* source, |
| 239 const gfx::Point& point, |
| 240 ui::ContextMenuSourceType source_type) { |
| 239 DCHECK_EQ(tree_view_, source); | 241 DCHECK_EQ(tree_view_, source); |
| 240 if (!tree_view_->GetSelectedNode()) | 242 if (!tree_view_->GetSelectedNode()) |
| 241 return; | 243 return; |
| 242 running_menu_for_root_ = | 244 running_menu_for_root_ = |
| 243 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == | 245 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == |
| 244 tree_model_->GetRoot()); | 246 tree_model_->GetRoot()); |
| 245 | 247 |
| 246 context_menu_runner_.reset(new views::MenuRunner(GetMenuModel())); | 248 context_menu_runner_.reset(new views::MenuRunner(GetMenuModel())); |
| 247 | 249 |
| 248 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), | 250 if (context_menu_runner_->RunContextMenuAt( |
| 249 NULL, gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPRIGHT, | 251 source->GetWidget()->GetTopLevelWidget(), |
| 252 NULL, gfx::Rect(point, gfx::Size()), source_type, |
| 250 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == | 253 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == |
| 251 views::MenuRunner::MENU_DELETED) | 254 views::MenuRunner::MENU_DELETED) |
| 252 return; | 255 return; |
| 253 } | 256 } |
| 254 | 257 |
| 255 void BookmarkEditorView::Init() { | 258 void BookmarkEditorView::Init() { |
| 256 bb_model_ = BookmarkModelFactory::GetForProfile(profile_); | 259 bb_model_ = BookmarkModelFactory::GetForProfile(profile_); |
| 257 DCHECK(bb_model_); | 260 DCHECK(bb_model_); |
| 258 bb_model_->AddObserver(this); | 261 bb_model_->AddObserver(this); |
| 259 | 262 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); | 624 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); |
| 622 } | 625 } |
| 623 return context_menu_model_.get(); | 626 return context_menu_model_.get(); |
| 624 } | 627 } |
| 625 | 628 |
| 626 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 629 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
| 627 const string16& title) { | 630 const string16& title) { |
| 628 if (!title.empty()) | 631 if (!title.empty()) |
| 629 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 632 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 630 } | 633 } |
| OLD | NEW |