| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #import "chrome/browser/ui/cocoa/menu_button.h" | 24 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 25 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 25 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 26 #include "chrome/browser/ui/extensions/extension_toolbar_icon_surfacing_bubble_d
elegate.h" | 26 #include "chrome/browser/ui/extensions/extension_toolbar_icon_surfacing_bubble_d
elegate.h" |
| 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 28 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 29 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 29 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 30 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h" | 30 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h" |
| 31 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
| 32 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 32 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
| 33 #include "ui/base/cocoa/appkit_utils.h" | 33 #include "ui/base/cocoa/appkit_utils.h" |
| 34 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 34 #include "ui/base/material_design/material_design_controller.h" | 35 #include "ui/base/material_design/material_design_controller.h" |
| 35 | 36 |
| 36 NSString* const kBrowserActionVisibilityChangedNotification = | 37 NSString* const kBrowserActionVisibilityChangedNotification = |
| 37 @"BrowserActionVisibilityChangedNotification"; | 38 @"BrowserActionVisibilityChangedNotification"; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 const CGFloat kAnimationDuration = 0.2; | 42 const CGFloat kAnimationDuration = 0.2; |
| 42 | 43 |
| 43 const CGFloat kChevronWidth = 18; | 44 const CGFloat kChevronWidth = 18; |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 | 1042 |
| 1042 - (ToolbarActionsBarBubbleMac*)createMessageBubble: | 1043 - (ToolbarActionsBarBubbleMac*)createMessageBubble: |
| 1043 (scoped_ptr<ToolbarActionsBarBubbleDelegate>)delegate | 1044 (scoped_ptr<ToolbarActionsBarBubbleDelegate>)delegate |
| 1044 anchorToSelf:(BOOL)anchorToSelf { | 1045 anchorToSelf:(BOOL)anchorToSelf { |
| 1045 DCHECK_GE([buttons_ count], 0u); | 1046 DCHECK_GE([buttons_ count], 0u); |
| 1046 NSView* anchorView = | 1047 NSView* anchorView = |
| 1047 anchorToSelf ? containerView_ : [[self toolbarController] appMenuButton]; | 1048 anchorToSelf ? containerView_ : [[self toolbarController] appMenuButton]; |
| 1048 NSPoint anchor = [self popupPointForView:anchorView | 1049 NSPoint anchor = [self popupPointForView:anchorView |
| 1049 withBounds:[anchorView bounds]]; | 1050 withBounds:[anchorView bounds]]; |
| 1050 | 1051 |
| 1051 anchor = [[containerView_ window] convertBaseToScreen:anchor]; | 1052 anchor = ui::ConvertPointFromWindowToScreen([containerView_ window], anchor); |
| 1052 activeBubble_ = [[ToolbarActionsBarBubbleMac alloc] | 1053 activeBubble_ = [[ToolbarActionsBarBubbleMac alloc] |
| 1053 initWithParentWindow:[containerView_ window] | 1054 initWithParentWindow:[containerView_ window] |
| 1054 anchorPoint:anchor | 1055 anchorPoint:anchor |
| 1055 delegate:std::move(delegate)]; | 1056 delegate:std::move(delegate)]; |
| 1056 [[NSNotificationCenter defaultCenter] | 1057 [[NSNotificationCenter defaultCenter] |
| 1057 addObserver:self | 1058 addObserver:self |
| 1058 selector:@selector(bubbleWindowClosing:) | 1059 selector:@selector(bubbleWindowClosing:) |
| 1059 name:NSWindowWillCloseNotification | 1060 name:NSWindowWillCloseNotification |
| 1060 object:[activeBubble_ window]]; | 1061 object:[activeBubble_ window]]; |
| 1061 return activeBubble_; | 1062 return activeBubble_; |
| 1062 } | 1063 } |
| 1063 | 1064 |
| 1064 - (void)bubbleWindowClosing:(NSNotification*)notification { | 1065 - (void)bubbleWindowClosing:(NSNotification*)notification { |
| 1065 activeBubble_ = nil; | 1066 activeBubble_ = nil; |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 - (void)setFocusedViewIndex:(NSInteger)index { | 1069 - (void)setFocusedViewIndex:(NSInteger)index { |
| 1069 DCHECK(isOverflow_); | 1070 DCHECK(isOverflow_); |
| 1070 focusedViewIndex_ = index; | 1071 focusedViewIndex_ = index; |
| 1071 } | 1072 } |
| 1072 | 1073 |
| 1073 #pragma mark - | 1074 #pragma mark - |
| 1074 #pragma mark Testing Methods | 1075 #pragma mark Testing Methods |
| 1075 | 1076 |
| 1076 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { | 1077 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { |
| 1077 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; | 1078 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; |
| 1078 } | 1079 } |
| 1079 | 1080 |
| 1080 @end | 1081 @end |
| OLD | NEW |