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

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

Issue 570403002: Fix bug in browser action overflow container (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_context_menu_model.h" 10 #include "chrome/browser/extensions/extension_context_menu_model.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 extensions::ExtensionRegistry::Get(browser_->profile())-> 232 extensions::ExtensionRegistry::Get(browser_->profile())->
233 enabled_extensions().GetByID(drop_data.id()); 233 enabled_extensions().GetByID(drop_data.id());
234 extensions::ExtensionToolbarModel* toolbar_model = 234 extensions::ExtensionToolbarModel* toolbar_model =
235 extensions::ExtensionToolbarModel::Get(browser_->profile()); 235 extensions::ExtensionToolbarModel::Get(browser_->profile());
236 if (browser_->profile()->IsOffTheRecord()) 236 if (browser_->profile()->IsOffTheRecord())
237 drop_index = toolbar_model->IncognitoIndexToOriginal(drop_index); 237 drop_index = toolbar_model->IncognitoIndexToOriginal(drop_index);
238 toolbar_model->MoveExtensionIcon(extension, drop_index); 238 toolbar_model->MoveExtensionIcon(extension, drop_index);
239 239
240 // If the extension was moved to the overflow menu from the main bar, notify 240 // If the extension was moved to the overflow menu from the main bar, notify
241 // the owner. 241 // the owner.
242 if (drop_index >= owner_->VisibleBrowserActions()) 242 if (drop_data.index() < owner_->VisibleBrowserActions())
243 owner_->NotifyActionMovedToOverflow(); 243 owner_->NotifyActionMovedToOverflow();
244 244
245 if (for_drop_) 245 if (for_drop_)
246 delete this; 246 delete this;
247 return ui::DragDropTypes::DRAG_MOVE; 247 return ui::DragDropTypes::DRAG_MOVE;
248 } 248 }
249 249
250 bool BrowserActionOverflowMenuController::CanDrag(views::MenuItemView* menu) { 250 bool BrowserActionOverflowMenuController::CanDrag(views::MenuItemView* menu) {
251 return true; 251 return true;
252 } 252 }
(...skipping 10 matching lines...) Expand all
263 views::MenuItemView* sender) { 263 views::MenuItemView* sender) {
264 return ui::DragDropTypes::DRAG_MOVE; 264 return ui::DragDropTypes::DRAG_MOVE;
265 } 265 }
266 266
267 size_t BrowserActionOverflowMenuController::IndexForId(int id) const { 267 size_t BrowserActionOverflowMenuController::IndexForId(int id) const {
268 // The index of the view being dragged (GetCommand gives a 1-based index into 268 // The index of the view being dragged (GetCommand gives a 1-based index into
269 // the overflow menu). 269 // the overflow menu).
270 DCHECK_GT(owner_->VisibleBrowserActions() + id, 0u); 270 DCHECK_GT(owner_->VisibleBrowserActions() + id, 0u);
271 return owner_->VisibleBrowserActions() + id - 1; 271 return owner_->VisibleBrowserActions() + id - 1;
272 } 272 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698