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 "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 menu_->Cancel(); | 82 menu_->Cancel(); |
83 } | 83 } |
84 | 84 |
85 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) { | 85 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) { |
86 return event_utils::IsPossibleDispositionEvent(e); | 86 return event_utils::IsPossibleDispositionEvent(e); |
87 } | 87 } |
88 | 88 |
89 void BookmarkMenuController::ExecuteCommand(int id, int mouse_event_flags) { | 89 void BookmarkMenuController::ExecuteCommand(int id, int mouse_event_flags) { |
90 DCHECK(page_navigator_); | 90 DCHECK(page_navigator_); |
91 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 91 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
92 GURL url = menu_id_to_node_map_[id]->GetURL(); | 92 |
93 page_navigator_->OpenURL( | 93 const BookmarkNode* node = menu_id_to_node_map_[id]; |
94 url, GURL(), event_utils::DispositionFromEventFlags(mouse_event_flags), | 94 std::vector<const BookmarkNode*> selection; |
95 PageTransition::AUTO_BOOKMARK); | 95 selection.push_back(node); |
| 96 |
| 97 WindowOpenDisposition initial_disposition = |
| 98 event_utils::DispositionFromEventFlags(mouse_event_flags); |
| 99 |
| 100 bookmark_utils::OpenAll(parent_, profile_, page_navigator_, selection, |
| 101 initial_disposition); |
96 } | 102 } |
97 | 103 |
98 bool BookmarkMenuController::GetDropFormats( | 104 bool BookmarkMenuController::GetDropFormats( |
99 MenuItemView* menu, | 105 MenuItemView* menu, |
100 int* formats, | 106 int* formats, |
101 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 107 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
102 *formats = OSExchangeData::URL; | 108 *formats = OSExchangeData::URL; |
103 custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat()); | 109 custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat()); |
104 return true; | 110 return true; |
105 } | 111 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 menu_id_to_node_map_[id] = node; | 333 menu_id_to_node_map_[id] = node; |
328 } | 334 } |
329 } | 335 } |
330 | 336 |
331 BookmarkMenuController::~BookmarkMenuController() { | 337 BookmarkMenuController::~BookmarkMenuController() { |
332 profile_->GetBookmarkModel()->RemoveObserver(this); | 338 profile_->GetBookmarkModel()->RemoveObserver(this); |
333 if (observer_) | 339 if (observer_) |
334 observer_->BookmarkMenuDeleted(this); | 340 observer_->BookmarkMenuDeleted(this); |
335 STLDeleteValues(&node_to_menu_map_); | 341 STLDeleteValues(&node_to_menu_map_); |
336 } | 342 } |
OLD | NEW |