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_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { | 126 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { |
127 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 127 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
128 | 128 |
129 const BookmarkNode* node = menu_id_to_node_map_[id]; | 129 const BookmarkNode* node = menu_id_to_node_map_[id]; |
130 std::vector<const BookmarkNode*> selection; | 130 std::vector<const BookmarkNode*> selection; |
131 selection.push_back(node); | 131 selection.push_back(node); |
132 | 132 |
133 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, | 133 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, |
134 chrome::DispositionFromEventFlags(mouse_event_flags)); | 134 chrome::DispositionFromEventFlags(mouse_event_flags), |
| 135 profile_); |
135 bookmark_utils::RecordBookmarkLaunch(location_); | 136 bookmark_utils::RecordBookmarkLaunch(location_); |
136 } | 137 } |
137 | 138 |
138 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( | 139 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( |
139 int id, const ui::Event& event) { | 140 int id, const ui::Event& event) { |
140 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && | 141 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && |
141 chrome::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; | 142 chrome::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; |
142 } | 143 } |
143 | 144 |
144 bool BookmarkMenuDelegate::GetDropFormats( | 145 bool BookmarkMenuDelegate::GetDropFormats( |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { | 497 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { |
497 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); | 498 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); |
498 i != node_to_menu_map_.end(); ++i) { | 499 i != node_to_menu_map_.end(); ++i) { |
499 MenuItemView* menu = i->second->GetMenuItemByID(id); | 500 MenuItemView* menu = i->second->GetMenuItemByID(id); |
500 if (menu) | 501 if (menu) |
501 return menu; | 502 return menu; |
502 } | 503 } |
503 | 504 |
504 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; | 505 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; |
505 } | 506 } |
OLD | NEW |