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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { | 131 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { |
132 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 132 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
133 | 133 |
134 const BookmarkNode* node = menu_id_to_node_map_[id]; | 134 const BookmarkNode* node = menu_id_to_node_map_[id]; |
135 std::vector<const BookmarkNode*> selection; | 135 std::vector<const BookmarkNode*> selection; |
136 selection.push_back(node); | 136 selection.push_back(node); |
137 | 137 |
138 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, | 138 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, |
139 ui::DispositionFromEventFlags(mouse_event_flags), | 139 ui::DispositionFromEventFlags(mouse_event_flags), |
140 profile_); | 140 profile_); |
141 RecordBookmarkLaunch(node, location_); | 141 RecordBookmarkLaunch(GetBookmarkModel(), node, location_); |
142 } | 142 } |
143 | 143 |
144 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( | 144 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( |
145 int id, | 145 int id, |
146 const ui::Event& event) { | 146 const ui::Event& event) { |
147 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && | 147 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && |
148 ui::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; | 148 ui::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; |
149 } | 149 } |
150 | 150 |
151 bool BookmarkMenuDelegate::GetDropFormats( | 151 bool BookmarkMenuDelegate::GetDropFormats( |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 BuildMenu(node, 0, submenu, next_menu_id); | 484 BuildMenu(node, 0, submenu, next_menu_id); |
485 } else { | 485 } else { |
486 NOTREACHED(); | 486 NOTREACHED(); |
487 } | 487 } |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 bool BookmarkMenuDelegate::IsOutsideMenuIdRange(int menu_id) const { | 491 bool BookmarkMenuDelegate::IsOutsideMenuIdRange(int menu_id) const { |
492 return menu_id < min_menu_id_ || menu_id > max_menu_id_; | 492 return menu_id < min_menu_id_ || menu_id > max_menu_id_; |
493 } | 493 } |
OLD | NEW |