| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/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_node_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_utils.h" | 11 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 12 #include "chrome/browser/event_disposition.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/views/event_utils.h" |
| 14 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 16 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 15 #include "chrome/browser/ui/views/event_utils.h" | |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "content/browser/tab_contents/page_navigator.h" | 18 #include "content/browser/tab_contents/page_navigator.h" |
| 18 #include "content/browser/user_metrics.h" | 19 #include "content/browser/user_metrics.h" |
| 19 #include "content/common/page_transition_types.h" | 20 #include "content/common/page_transition_types.h" |
| 20 #include "grit/app_resources.h" | 21 #include "grit/app_resources.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 23 #include "ui/base/dragdrop/os_exchange_data.h" | 24 #include "ui/base/dragdrop/os_exchange_data.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 96 } |
| 96 | 97 |
| 97 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { | 98 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { |
| 98 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 99 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
| 99 | 100 |
| 100 const BookmarkNode* node = menu_id_to_node_map_[id]; | 101 const BookmarkNode* node = menu_id_to_node_map_[id]; |
| 101 std::vector<const BookmarkNode*> selection; | 102 std::vector<const BookmarkNode*> selection; |
| 102 selection.push_back(node); | 103 selection.push_back(node); |
| 103 | 104 |
| 104 WindowOpenDisposition initial_disposition = | 105 WindowOpenDisposition initial_disposition = |
| 105 event_utils::DispositionFromEventFlags(mouse_event_flags); | 106 browser::DispositionFromEventFlags(mouse_event_flags); |
| 106 | 107 |
| 107 bookmark_utils::OpenAll(parent_, profile_, page_navigator_, selection, | 108 bookmark_utils::OpenAll(parent_, profile_, page_navigator_, selection, |
| 108 initial_disposition); | 109 initial_disposition); |
| 109 } | 110 } |
| 110 | 111 |
| 111 bool BookmarkMenuDelegate::GetDropFormats( | 112 bool BookmarkMenuDelegate::GetDropFormats( |
| 112 MenuItemView* menu, | 113 MenuItemView* menu, |
| 113 int* formats, | 114 int* formats, |
| 114 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { | 115 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { |
| 115 *formats = ui::OSExchangeData::URL; | 116 *formats = ui::OSExchangeData::URL; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 break; | 430 break; |
| 430 } | 431 } |
| 431 } | 432 } |
| 432 if (ancestor_removed) { | 433 if (ancestor_removed) { |
| 433 node_to_menu_id_map_.erase(i++); | 434 node_to_menu_id_map_.erase(i++); |
| 434 } else { | 435 } else { |
| 435 ++i; | 436 ++i; |
| 436 } | 437 } |
| 437 } | 438 } |
| 438 } | 439 } |
| OLD | NEW |