Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc

Issue 11896047: Move the methods in disposition_utils.h and event_disposition.h to ui\base\window_open_disposition.… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix regex in ui.gyp Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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_model_factory.h" 9 #include "chrome/browser/bookmarks/bookmark_model_factory.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"
13 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 14 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
16 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 16 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
18 #include "chrome/browser/ui/views/event_utils.h" 17 #include "chrome/browser/ui/views/event_utils.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
20 #include "content/public/browser/page_navigator.h" 19 #include "content/public/browser/page_navigator.h"
21 #include "content/public/browser/user_metrics.h" 20 #include "content/public/browser/user_metrics.h"
22 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
24 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
25 #include "ui/base/dragdrop/os_exchange_data.h" 24 #include "ui/base/dragdrop/os_exchange_data.h"
26 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/base/window_open_disposition.h"
28 #include "ui/views/controls/button/menu_button.h" 28 #include "ui/views/controls/button/menu_button.h"
29 #include "ui/views/controls/menu/menu_item_view.h" 29 #include "ui/views/controls/menu/menu_item_view.h"
30 #include "ui/views/controls/menu/submenu_view.h" 30 #include "ui/views/controls/menu/submenu_view.h"
31 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
32 32
33 using content::PageNavigator; 33 using content::PageNavigator;
34 using content::UserMetricsAction; 34 using content::UserMetricsAction;
35 using views::MenuItemView; 35 using views::MenuItemView;
36 36
37 // Max width of a menu. There does not appear to be an OS value for this, yet 37 // Max width of a menu. There does not appear to be an OS value for this, yet
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { 126 void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) {
127 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); 127 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
128 128
129 const BookmarkNode* node = menu_id_to_node_map_[id]; 129 const BookmarkNode* node = menu_id_to_node_map_[id];
130 std::vector<const BookmarkNode*> selection; 130 std::vector<const BookmarkNode*> selection;
131 selection.push_back(node); 131 selection.push_back(node);
132 132
133 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection, 133 chrome::OpenAll(parent_->GetNativeWindow(), page_navigator_, selection,
134 chrome::DispositionFromEventFlags(mouse_event_flags), 134 ui::DispositionFromEventFlags(mouse_event_flags),
135 profile_); 135 profile_);
136 bookmark_utils::RecordBookmarkLaunch(location_); 136 bookmark_utils::RecordBookmarkLaunch(location_);
137 } 137 }
138 138
139 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu( 139 bool BookmarkMenuDelegate::ShouldExecuteCommandWithoutClosingMenu(
140 int id, const ui::Event& event) { 140 int id, const ui::Event& event) {
141 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) && 141 return (event.flags() & ui::EF_LEFT_MOUSE_BUTTON) &&
142 chrome::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB; 142 ui::DispositionFromEventFlags(event.flags()) == NEW_BACKGROUND_TAB;
143 } 143 }
144 144
145 bool BookmarkMenuDelegate::GetDropFormats( 145 bool BookmarkMenuDelegate::GetDropFormats(
146 MenuItemView* menu, 146 MenuItemView* menu,
147 int* formats, 147 int* formats,
148 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { 148 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) {
149 *formats = ui::OSExchangeData::URL; 149 *formats = ui::OSExchangeData::URL;
150 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); 150 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat());
151 return true; 151 return true;
152 } 152 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { 497 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) {
498 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); 498 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin());
499 i != node_to_menu_map_.end(); ++i) { 499 i != node_to_menu_map_.end(); ++i) {
500 MenuItemView* menu = i->second->GetMenuItemByID(id); 500 MenuItemView* menu = i->second->GetMenuItemByID(id);
501 if (menu) 501 if (menu)
502 return menu; 502 return menu;
503 } 503 }
504 504
505 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; 505 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL;
506 } 506 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc ('k') | chrome/browser/ui/views/chrome_views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698