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

Side by Side Diff: trunk/src/chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.mm

Issue 116973002: Revert 241085 "[rAc] [OSX] Set tooltip bubble arrow's anchor poi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/autofill_tooltip_controller.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.h" 8 #import "chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.h"
9 #import "ui/base/cocoa/hover_image_button.h" 9 #import "ui/base/cocoa/hover_image_button.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 @end 61 @end
62 62
63 #pragma mark AutofillTooltipController 63 #pragma mark AutofillTooltipController
64 64
65 @implementation AutofillTooltipController 65 @implementation AutofillTooltipController
66 66
67 @synthesize message = message_; 67 @synthesize message = message_;
68 68
69 - (id)initWithArrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation { 69 - (id)init {
70 if ((self = [super init])) { 70 if ((self = [super init])) {
71 arrowLocation_ = arrowLocation;
72 view_.reset([[AutofillTooltip alloc] init]); 71 view_.reset([[AutofillTooltip alloc] init]);
73 [self setView:view_]; 72 [self setView:view_];
74 [view_ setTooltipDelegate:self]; 73 [view_ setTooltipDelegate:self];
75 } 74 }
76 return self; 75 return self;
77 } 76 }
78 77
79 - (void)dealloc { 78 - (void)dealloc {
80 [[NSNotificationCenter defaultCenter] 79 [[NSNotificationCenter defaultCenter]
81 removeObserver:self 80 removeObserver:self
(...skipping 20 matching lines...) Expand all
102 - (void)tooltipWindowWillClose:(NSNotification*)notification { 101 - (void)tooltipWindowWillClose:(NSNotification*)notification {
103 bubbleController_ = nil; 102 bubbleController_ = nil;
104 } 103 }
105 104
106 - (void)displayHover { 105 - (void)displayHover {
107 [bubbleController_ close]; 106 [bubbleController_ close];
108 bubbleController_ = 107 bubbleController_ =
109 [[AutofillBubbleController alloc] 108 [[AutofillBubbleController alloc]
110 initWithParentWindow:[[self view] window] 109 initWithParentWindow:[[self view] window]
111 message:[self message] 110 message:[self message]
112 inset:NSMakeSize(kTooltipInset, kTooltipInset) 111 inset:NSMakeSize(kTooltipInset, kTooltipInset)];
113 arrowLocation:arrowLocation_];
114 112
115 // Handle bubble self-deleting. 113 // Handle bubble self-deleting.
116 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 114 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
117 [center addObserver:self 115 [center addObserver:self
118 selector:@selector(tooltipWindowWillClose:) 116 selector:@selector(tooltipWindowWillClose:)
119 name:NSWindowWillCloseNotification 117 name:NSWindowWillCloseNotification
120 object:[bubbleController_ window]]; 118 object:[bubbleController_ window]];
121 119
122 // Compute anchor point (in window coords - views might be flipped). 120 // Compute anchor point (in window coords - views might be flipped).
123 NSRect viewRect = [view_ convertRect:[view_ bounds] toView:nil]; 121 NSRect viewRect = [view_ convertRect:[view_ bounds] toView:nil];
(...skipping 11 matching lines...) Expand all
135 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 133 [NSObject cancelPreviousPerformRequestsWithTarget:self];
136 // Start a timer to display the tooltip, unless it's already hidden. 134 // Start a timer to display the tooltip, unless it's already hidden.
137 if (bubbleController_) { 135 if (bubbleController_) {
138 [self performSelector:@selector(hideHover) 136 [self performSelector:@selector(hideHover)
139 withObject:nil 137 withObject:nil
140 afterDelay:kTooltipDelay]; 138 afterDelay:kTooltipDelay];
141 } 139 }
142 } 140 }
143 141
144 @end 142 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698