OLD | NEW |
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 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 NSUInteger index = 0; | 692 NSUInteger index = 0; |
693 for (ExtensionList::const_iterator iter = | 693 for (ExtensionList::const_iterator iter = |
694 toolbarModel_->toolbar_items().begin(); | 694 toolbarModel_->toolbar_items().begin(); |
695 iter != toolbarModel_->toolbar_items().end(); ++iter) { | 695 iter != toolbarModel_->toolbar_items().end(); ++iter) { |
696 BrowserActionButton* button = [self buttonForExtension:(iter->get())]; | 696 BrowserActionButton* button = [self buttonForExtension:(iter->get())]; |
697 CGFloat intersectionWidth = | 697 CGFloat intersectionWidth = |
698 NSWidth(NSIntersectionRect(draggedButtonFrame, [button frame])); | 698 NSWidth(NSIntersectionRect(draggedButtonFrame, [button frame])); |
699 | 699 |
700 if (intersectionWidth > dragThreshold && button != draggedButton && | 700 if (intersectionWidth > dragThreshold && button != draggedButton && |
701 ![button isAnimating] && index < [self visibleButtonCount]) { | 701 ![button isAnimating] && index < [self visibleButtonCount]) { |
702 toolbarModel_->MoveExtensionIcon([draggedButton extension], index); | 702 toolbarModel_->MoveExtensionIcon([draggedButton extension]->id(), index); |
703 [self positionActionButtonsAndAnimate:YES]; | 703 [self positionActionButtonsAndAnimate:YES]; |
704 return; | 704 return; |
705 } | 705 } |
706 ++index; | 706 ++index; |
707 } | 707 } |
708 } | 708 } |
709 | 709 |
710 - (void)actionButtonDragFinished:(NSNotification*)notification { | 710 - (void)actionButtonDragFinished:(NSNotification*)notification { |
711 [self showChevronIfNecessaryInFrame:[containerView_ frame] animate:YES]; | 711 [self showChevronIfNecessaryInFrame:[containerView_ frame] animate:YES]; |
712 [self positionActionButtonsAndAnimate:YES]; | 712 [self positionActionButtonsAndAnimate:YES]; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 const extensions::ExtensionList& toolbar_items = | 858 const extensions::ExtensionList& toolbar_items = |
859 toolbarModel_->toolbar_items(); | 859 toolbarModel_->toolbar_items(); |
860 if (index < toolbar_items.size()) { | 860 if (index < toolbar_items.size()) { |
861 const Extension* extension = toolbar_items[index].get(); | 861 const Extension* extension = toolbar_items[index].get(); |
862 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 862 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
863 } | 863 } |
864 return nil; | 864 return nil; |
865 } | 865 } |
866 | 866 |
867 @end | 867 @end |
OLD | NEW |