| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/extensions/browser_actions_container_view.h" | 5 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" | 
|  | 11 #import "chrome/browser/cocoa/view_id_util.h" | 
| 11 | 12 | 
| 12 NSString* const kBrowserActionGrippyDragStartedNotification = | 13 NSString* const kBrowserActionGrippyDragStartedNotification = | 
| 13     @"BrowserActionGrippyDragStartedNotification"; | 14     @"BrowserActionGrippyDragStartedNotification"; | 
| 14 NSString* const kBrowserActionGrippyDraggingNotification = | 15 NSString* const kBrowserActionGrippyDraggingNotification = | 
| 15     @"BrowserActionGrippyDraggingNotification"; | 16     @"BrowserActionGrippyDraggingNotification"; | 
| 16 NSString* const kBrowserActionGrippyDragFinishedNotification = | 17 NSString* const kBrowserActionGrippyDragFinishedNotification = | 
| 17     @"BrowserActionGrippyDragFinishedNotification"; | 18     @"BrowserActionGrippyDragFinishedNotification"; | 
| 18 | 19 | 
| 19 namespace { | 20 namespace { | 
| 20 const CGFloat kAnimationDuration = 0.2; | 21 const CGFloat kAnimationDuration = 0.2; | 
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 152   [self setFrame:containerFrame]; | 153   [self setFrame:containerFrame]; | 
| 153   [self setNeedsDisplay:YES]; | 154   [self setNeedsDisplay:YES]; | 
| 154 | 155 | 
| 155   [[NSNotificationCenter defaultCenter] | 156   [[NSNotificationCenter defaultCenter] | 
| 156       postNotificationName:kBrowserActionGrippyDraggingNotification | 157       postNotificationName:kBrowserActionGrippyDraggingNotification | 
| 157                     object:self]; | 158                     object:self]; | 
| 158 | 159 | 
| 159   lastXPos_ += dX; | 160   lastXPos_ += dX; | 
| 160 } | 161 } | 
| 161 | 162 | 
|  | 163 - (ViewID)viewID { | 
|  | 164   return VIEW_ID_BROWSER_ACTION_TOOLBAR; | 
|  | 165 } | 
|  | 166 | 
| 162 #pragma mark - | 167 #pragma mark - | 
| 163 #pragma mark Public Methods | 168 #pragma mark Public Methods | 
| 164 | 169 | 
| 165 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate { | 170 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate { | 
| 166   width = std::max(width, kMinimumContainerWidth); | 171   width = std::max(width, kMinimumContainerWidth); | 
| 167   NSRect frame = [self frame]; | 172   NSRect frame = [self frame]; | 
| 168   lastXPos_ = frame.origin.x; | 173   lastXPos_ = frame.origin.x; | 
| 169   CGFloat dX = frame.size.width - width; | 174   CGFloat dX = frame.size.width - width; | 
| 170   frame.size.width = width; | 175   frame.size.width = width; | 
| 171   NSRect newFrame = NSOffsetRect(frame, dX, 0); | 176   NSRect newFrame = NSOffsetRect(frame, dX, 0); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 198     retVal = [NSCursor resizeRightCursor]; | 203     retVal = [NSCursor resizeRightCursor]; | 
| 199   } else if (!canDragRight_) { | 204   } else if (!canDragRight_) { | 
| 200     retVal = [NSCursor resizeLeftCursor]; | 205     retVal = [NSCursor resizeLeftCursor]; | 
| 201   } else { | 206   } else { | 
| 202     retVal = [NSCursor resizeLeftRightCursor]; | 207     retVal = [NSCursor resizeLeftRightCursor]; | 
| 203   } | 208   } | 
| 204   return retVal; | 209   return retVal; | 
| 205 } | 210 } | 
| 206 | 211 | 
| 207 @end | 212 @end | 
| OLD | NEW | 
|---|