| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bookmark_utils::RecordBookmarkLaunch(location_); | 135 bookmark_utils::RecordBookmarkLaunch(location_); |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( |
| 139 int id, const ui::Event& event) { |
| 140 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && |
| 141 chrome::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; |
| 142 } |
| 143 |
| 138 bool BookmarkMenuDelegate::GetDropFormats( | 144 bool BookmarkMenuDelegate::GetDropFormats( |
| 139 MenuItemView* menu, | 145 MenuItemView* menu, |
| 140 int* formats, | 146 int* formats, |
| 141 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { | 147 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { |
| 142 *formats = ui::OSExchangeData::URL; | 148 *formats = ui::OSExchangeData::URL; |
| 143 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); | 149 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); |
| 144 return true; | 150 return true; |
| 145 } | 151 } |
| 146 | 152 |
| 147 bool BookmarkMenuDelegate::AreDropTypesRequired(MenuItemView* menu) { | 153 bool BookmarkMenuDelegate::AreDropTypesRequired(MenuItemView* menu) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { | 496 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { |
| 491 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); | 497 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); |
| 492 i != node_to_menu_map_.end(); ++i) { | 498 i != node_to_menu_map_.end(); ++i) { |
| 493 MenuItemView* menu = i->second->GetMenuItemByID(id); | 499 MenuItemView* menu = i->second->GetMenuItemByID(id); |
| 494 if (menu) | 500 if (menu) |
| 495 return menu; | 501 return menu; |
| 496 } | 502 } |
| 497 | 503 |
| 498 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; | 504 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; |
| 499 } | 505 } |
| OLD | NEW |