OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_container_view.h" | 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
10 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
11 #include "ui/base/cocoa/appkit_utils.h" | 12 #include "ui/base/cocoa/appkit_utils.h" |
12 #include "ui/events/keycodes/keyboard_code_conversion_mac.h" | 13 #include "ui/events/keycodes/keyboard_code_conversion_mac.h" |
13 | 14 |
14 NSString* const kBrowserActionGrippyDragStartedNotification = | 15 NSString* const kBrowserActionGrippyDragStartedNotification = |
15 @"BrowserActionGrippyDragStartedNotification"; | 16 @"BrowserActionGrippyDragStartedNotification"; |
16 NSString* const kBrowserActionGrippyDraggingNotification = | 17 NSString* const kBrowserActionGrippyDraggingNotification = |
17 @"BrowserActionGrippyDraggingNotification"; | 18 @"BrowserActionGrippyDraggingNotification"; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 NSDictionary* userInfo = @{ kBrowserActionsContainerKeyEventKey : @(action) }; | 161 NSDictionary* userInfo = @{ kBrowserActionsContainerKeyEventKey : @(action) }; |
161 [[NSNotificationCenter defaultCenter] | 162 [[NSNotificationCenter defaultCenter] |
162 postNotificationName:kBrowserActionsContainerReceivedKeyEvent | 163 postNotificationName:kBrowserActionsContainerReceivedKeyEvent |
163 object:self | 164 object:self |
164 userInfo:userInfo]; | 165 userInfo:userInfo]; |
165 [super keyDown:theEvent]; | 166 [super keyDown:theEvent]; |
166 } | 167 } |
167 | 168 |
168 - (void)setHighlight:(scoped_ptr<ui::NinePartImageIds>)highlight { | 169 - (void)setHighlight:(scoped_ptr<ui::NinePartImageIds>)highlight { |
169 if (highlight || highlight_) { | 170 if (highlight || highlight_) { |
170 highlight_ = highlight.Pass(); | 171 highlight_ = std::move(highlight); |
171 // We don't allow resizing when the container is highlighting. | 172 // We don't allow resizing when the container is highlighting. |
172 resizable_ = highlight.get() == nullptr; | 173 resizable_ = highlight.get() == nullptr; |
173 [self setNeedsDisplay:YES]; | 174 [self setNeedsDisplay:YES]; |
174 } | 175 } |
175 } | 176 } |
176 | 177 |
177 - (void)setIsOverflow:(BOOL)isOverflow { | 178 - (void)setIsOverflow:(BOOL)isOverflow { |
178 if (isOverflow_ != isOverflow) { | 179 if (isOverflow_ != isOverflow) { |
179 isOverflow_ = isOverflow; | 180 isOverflow_ = isOverflow; |
180 resizable_ = !isOverflow_; | 181 resizable_ = !isOverflow_; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 retVal = [NSCursor resizeLeftRightCursor]; | 363 retVal = [NSCursor resizeLeftRightCursor]; |
363 } | 364 } |
364 return retVal; | 365 return retVal; |
365 } | 366 } |
366 | 367 |
367 - (CGFloat)maxAllowedWidth { | 368 - (CGFloat)maxAllowedWidth { |
368 return delegate_ ? delegate_->GetMaxAllowedWidth() : CGFLOAT_MAX; | 369 return delegate_ ? delegate_->GetMaxAllowedWidth() : CGFLOAT_MAX; |
369 } | 370 } |
370 | 371 |
371 @end | 372 @end |
OLD | NEW |