OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bookmark_menu_controller_views.h" | 5 #include "chrome/browser/views/bookmark_menu_controller_views.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/os_exchange_data.h" | 8 #include "app/os_exchange_data.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 menu_->Cancel(); | 60 menu_->Cancel(); |
61 } | 61 } |
62 | 62 |
63 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) { | 63 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) { |
64 return event_utils::IsPossibleDispositionEvent(e); | 64 return event_utils::IsPossibleDispositionEvent(e); |
65 } | 65 } |
66 | 66 |
67 void BookmarkMenuController::ExecuteCommand(int id, int mouse_event_flags) { | 67 void BookmarkMenuController::ExecuteCommand(int id, int mouse_event_flags) { |
68 DCHECK(page_navigator_); | 68 DCHECK(page_navigator_); |
69 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 69 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
70 GURL url = menu_id_to_node_map_[id]->GetURL(); | 70 |
71 page_navigator_->OpenURL( | 71 const BookmarkNode* node = menu_id_to_node_map_[id]; |
72 url, GURL(), event_utils::DispositionFromEventFlags(mouse_event_flags), | 72 std::vector<const BookmarkNode*> selection; |
73 PageTransition::AUTO_BOOKMARK); | 73 selection.push_back(node); |
| 74 |
| 75 WindowOpenDisposition initial_disposition = |
| 76 event_utils::DispositionFromEventFlags(mouse_event_flags); |
| 77 |
| 78 bookmark_utils::OpenAll(parent_, profile_, page_navigator_, selection, |
| 79 initial_disposition); |
74 } | 80 } |
75 | 81 |
76 bool BookmarkMenuController::GetDropFormats( | 82 bool BookmarkMenuController::GetDropFormats( |
77 views::MenuItemView* menu, | 83 views::MenuItemView* menu, |
78 int* formats, | 84 int* formats, |
79 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 85 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
80 *formats = OSExchangeData::URL; | 86 *formats = OSExchangeData::URL; |
81 custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat()); | 87 custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat()); |
82 return true; | 88 return true; |
83 } | 89 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 266 } |
261 menu_id_to_node_map_[id] = node; | 267 menu_id_to_node_map_[id] = node; |
262 } | 268 } |
263 } | 269 } |
264 | 270 |
265 BookmarkMenuController::~BookmarkMenuController() { | 271 BookmarkMenuController::~BookmarkMenuController() { |
266 profile_->GetBookmarkModel()->RemoveObserver(this); | 272 profile_->GetBookmarkModel()->RemoveObserver(this); |
267 if (observer_) | 273 if (observer_) |
268 observer_->BookmarkMenuDeleted(this); | 274 observer_->BookmarkMenuDeleted(this); |
269 } | 275 } |
OLD | NEW |