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/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_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
14 #include "chrome/browser/ui/views/event_utils.h" | 14 #include "chrome/browser/ui/views/event_utils.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 #include "content/browser/tab_contents/page_navigator.h" | 16 #include "content/browser/tab_contents/page_navigator.h" |
17 #include "content/browser/user_metrics.h" | 17 #include "content/browser/user_metrics.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "grit/ui_resources.h" | 20 #include "grit/ui_resources.h" |
21 #include "ui/base/dragdrop/os_exchange_data.h" | 21 #include "ui/base/dragdrop/os_exchange_data.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/views/widget/widget.h" |
24 #include "views/controls/button/menu_button.h" | 25 #include "views/controls/button/menu_button.h" |
25 #include "views/controls/menu/menu_item_view.h" | 26 #include "views/controls/menu/menu_item_view.h" |
26 #include "views/controls/menu/submenu_view.h" | 27 #include "views/controls/menu/submenu_view.h" |
27 #include "views/widget/widget.h" | |
28 | 28 |
29 using views::MenuItemView; | 29 using views::MenuItemView; |
30 | 30 |
31 // Max width of a menu. There does not appear to be an OS value for this, yet | 31 // Max width of a menu. There does not appear to be an OS value for this, yet |
32 // both IE and FF restrict the max width of a menu. | 32 // both IE and FF restrict the max width of a menu. |
33 static const int kMaxMenuWidth = 400; | 33 static const int kMaxMenuWidth = 400; |
34 | 34 |
35 BookmarkMenuDelegate::BookmarkMenuDelegate(Profile* profile, | 35 BookmarkMenuDelegate::BookmarkMenuDelegate(Profile* profile, |
36 PageNavigator* navigator, | 36 PageNavigator* navigator, |
37 views::Widget* parent, | 37 views::Widget* parent, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { | 447 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { |
448 for (NodeToMenuMap::const_iterator i = node_to_menu_map_.begin(); | 448 for (NodeToMenuMap::const_iterator i = node_to_menu_map_.begin(); |
449 i != node_to_menu_map_.end(); ++i) { | 449 i != node_to_menu_map_.end(); ++i) { |
450 MenuItemView* menu = i->second->GetMenuItemByID(id); | 450 MenuItemView* menu = i->second->GetMenuItemByID(id); |
451 if (menu) | 451 if (menu) |
452 return menu; | 452 return menu; |
453 } | 453 } |
454 | 454 |
455 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; | 455 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; |
456 } | 456 } |
OLD | NEW |