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_menu_delegate.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 event_utils::IsPossibleDispositionEvent(e); | 120 event_utils::IsPossibleDispositionEvent(e); |
121 } | 121 } |
122 | 122 |
123 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { | 123 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { |
124 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 124 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
125 | 125 |
126 const BookmarkNode* node = menu_id_to_node_map_[id]; | 126 const BookmarkNode* node = menu_id_to_node_map_[id]; |
127 std::vector<const BookmarkNode*> selection; | 127 std::vector<const BookmarkNode*> selection; |
128 selection.push_back(node); | 128 selection.push_back(node); |
129 | 129 |
130 bookmark_utils::OpenAll(parent_->GetNativeWindow(), profile_, page_navigator_, | 130 bookmark_utils::OpenAll( |
131 selection, chrome::DispositionFromEventFlags(mouse_event_flags)); | 131 parent_->GetNativeWindow(), page_navigator_, selection, |
| 132 chrome::DispositionFromEventFlags(mouse_event_flags)); |
132 bookmark_utils::RecordBookmarkLaunch(location_); | 133 bookmark_utils::RecordBookmarkLaunch(location_); |
133 } | 134 } |
134 | 135 |
135 bool BookmarkMenuDelegate::GetDropFormats( | 136 bool BookmarkMenuDelegate::GetDropFormats( |
136 MenuItemView* menu, | 137 MenuItemView* menu, |
137 int* formats, | 138 int* formats, |
138 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { | 139 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { |
139 *formats = ui::OSExchangeData::URL; | 140 *formats = ui::OSExchangeData::URL; |
140 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); | 141 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); |
141 return true; | 142 return true; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { | 484 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { |
484 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); | 485 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); |
485 i != node_to_menu_map_.end(); ++i) { | 486 i != node_to_menu_map_.end(); ++i) { |
486 MenuItemView* menu = i->second->GetMenuItemByID(id); | 487 MenuItemView* menu = i->second->GetMenuItemByID(id); |
487 if (menu) | 488 if (menu) |
488 return menu; | 489 return menu; |
489 } | 490 } |
490 | 491 |
491 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; | 492 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; |
492 } | 493 } |
OLD | NEW |