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/extension_popup_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/debugger/devtools_window.h" | 9 #include "chrome/browser/debugger/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 // Pad the window by half of the rounded corner radius to prevent the | 282 // Pad the window by half of the rounded corner radius to prevent the |
283 // extension's view from bleeding out over the corners. | 283 // extension's view from bleeding out over the corners. |
284 CGFloat inset = info_bubble::kBubbleCornerRadius / 2.0; | 284 CGFloat inset = info_bubble::kBubbleCornerRadius / 2.0; |
285 [extensionView_ setFrameOrigin:NSMakePoint(inset, inset)]; | 285 [extensionView_ setFrameOrigin:NSMakePoint(inset, inset)]; |
286 | 286 |
287 NSRect frame = [extensionView_ frame]; | 287 NSRect frame = [extensionView_ frame]; |
288 frame.size.height += info_bubble::kBubbleArrowHeight + | 288 frame.size.height += info_bubble::kBubbleArrowHeight + |
289 info_bubble::kBubbleCornerRadius; | 289 info_bubble::kBubbleCornerRadius; |
290 frame.size.width += info_bubble::kBubbleCornerRadius; | 290 frame.size.width += info_bubble::kBubbleCornerRadius; |
291 frame = [extensionView_ convertRectToBase:frame]; | 291 frame = [extensionView_ convertRect:frame toView:nil]; |
292 // Adjust the origin according to the height and width so that the arrow is | 292 // Adjust the origin according to the height and width so that the arrow is |
293 // positioned correctly at the middle and slightly down from the button. | 293 // positioned correctly at the middle and slightly down from the button. |
294 NSPoint windowOrigin = self.anchorPoint; | 294 NSPoint windowOrigin = self.anchorPoint; |
295 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + | 295 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + |
296 info_bubble::kBubbleArrowWidth / 2.0, | 296 info_bubble::kBubbleArrowWidth / 2.0, |
297 info_bubble::kBubbleArrowHeight / 2.0); | 297 info_bubble::kBubbleArrowHeight / 2.0); |
298 offsets = [extensionView_ convertSize:offsets toView:nil]; | 298 offsets = [extensionView_ convertSize:offsets toView:nil]; |
299 windowOrigin.x -= NSWidth(frame) - offsets.width; | 299 windowOrigin.x -= NSWidth(frame) - offsets.width; |
300 windowOrigin.y -= NSHeight(frame) - offsets.height; | 300 windowOrigin.y -= NSHeight(frame) - offsets.height; |
301 frame.origin = windowOrigin; | 301 frame.origin = windowOrigin; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return minSize; | 369 return minSize; |
370 } | 370 } |
371 | 371 |
372 // Private (TestingAPI) | 372 // Private (TestingAPI) |
373 + (NSSize)maxPopupSize { | 373 + (NSSize)maxPopupSize { |
374 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 374 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
375 return maxSize; | 375 return maxSize; |
376 } | 376 } |
377 | 377 |
378 @end | 378 @end |
OLD | NEW |