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

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc

Issue 10824295: Rid the world of the last of views::Event types: TouchEvent, GestureEvent, MouseWheelEvent, ScrollE… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/extensions/browser_action_overflow_menu_contro ller.h" 5 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_context_menu_model.h" 9 #include "chrome/browser/extensions/extension_context_menu_model.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool BrowserActionOverflowMenuController::CanDrop( 149 bool BrowserActionOverflowMenuController::CanDrop(
150 views::MenuItemView* menu, const OSExchangeData& data) { 150 views::MenuItemView* menu, const OSExchangeData& data) {
151 BrowserActionDragData drop_data; 151 BrowserActionDragData drop_data;
152 if (!drop_data.Read(data)) 152 if (!drop_data.Read(data))
153 return false; 153 return false;
154 return drop_data.IsFromProfile(owner_->profile()); 154 return drop_data.IsFromProfile(owner_->profile());
155 } 155 }
156 156
157 int BrowserActionOverflowMenuController::GetDropOperation( 157 int BrowserActionOverflowMenuController::GetDropOperation(
158 views::MenuItemView* item, 158 views::MenuItemView* item,
159 const views::DropTargetEvent& event, 159 const ui::DropTargetEvent& event,
160 DropPosition* position) { 160 DropPosition* position) {
161 // Don't allow dropping from the BrowserActionContainer into slot 0 of the 161 // Don't allow dropping from the BrowserActionContainer into slot 0 of the
162 // overflow menu since once the move has taken place the item you are dragging 162 // overflow menu since once the move has taken place the item you are dragging
163 // falls right out of the menu again once the user releases the button 163 // falls right out of the menu again once the user releases the button
164 // (because we don't shrink the BrowserActionContainer when you do this). 164 // (because we don't shrink the BrowserActionContainer when you do this).
165 if ((item->GetCommand() == 0) && (*position == DROP_BEFORE)) { 165 if ((item->GetCommand() == 0) && (*position == DROP_BEFORE)) {
166 BrowserActionDragData drop_data; 166 BrowserActionDragData drop_data;
167 if (!drop_data.Read(event.data())) 167 if (!drop_data.Read(event.data()))
168 return ui::DragDropTypes::DRAG_NONE; 168 return ui::DragDropTypes::DRAG_NONE;
169 169
170 if (drop_data.index() < owner_->VisibleBrowserActions()) 170 if (drop_data.index() < owner_->VisibleBrowserActions())
171 return ui::DragDropTypes::DRAG_NONE; 171 return ui::DragDropTypes::DRAG_NONE;
172 } 172 }
173 173
174 return ui::DragDropTypes::DRAG_MOVE; 174 return ui::DragDropTypes::DRAG_MOVE;
175 } 175 }
176 176
177 int BrowserActionOverflowMenuController::OnPerformDrop( 177 int BrowserActionOverflowMenuController::OnPerformDrop(
178 views::MenuItemView* menu, 178 views::MenuItemView* menu,
179 DropPosition position, 179 DropPosition position,
180 const views::DropTargetEvent& event) { 180 const ui::DropTargetEvent& event) {
181 BrowserActionDragData drop_data; 181 BrowserActionDragData drop_data;
182 if (!drop_data.Read(event.data())) 182 if (!drop_data.Read(event.data()))
183 return ui::DragDropTypes::DRAG_NONE; 183 return ui::DragDropTypes::DRAG_NONE;
184 184
185 size_t drop_index; 185 size_t drop_index;
186 ViewForId(menu->GetCommand(), &drop_index); 186 ViewForId(menu->GetCommand(), &drop_index);
187 187
188 // When not dragging within the overflow menu (dragging an icon into the menu) 188 // When not dragging within the overflow menu (dragging an icon into the menu)
189 // subtract one to get the right index. 189 // subtract one to get the right index.
190 if (position == DROP_BEFORE && 190 if (position == DROP_BEFORE &&
(...skipping 28 matching lines...) Expand all
219 219
220 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( 220 BrowserActionView* BrowserActionOverflowMenuController::ViewForId(
221 int id, size_t* index) { 221 int id, size_t* index) {
222 // The index of the view being dragged (GetCommand gives a 1-based index into 222 // The index of the view being dragged (GetCommand gives a 1-based index into
223 // the overflow menu). 223 // the overflow menu).
224 size_t view_index = owner_->VisibleBrowserActions() + id - 1; 224 size_t view_index = owner_->VisibleBrowserActions() + id - 1;
225 if (index) 225 if (index)
226 *index = view_index; 226 *index = view_index;
227 return owner_->GetBrowserActionViewAt(view_index); 227 return owner_->GetBrowserActionViewAt(view_index);
228 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698