| 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/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/mac/sdk_forward_declarations.h" | 12 #include "base/mac/sdk_forward_declarations.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 17 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 17 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 18 #include "components/bubble/bubble_controller.h" | 18 #include "components/bubble/bubble_controller.h" |
| 19 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 19 | 20 |
| 20 @interface BaseBubbleController (Private) | 21 @interface BaseBubbleController (Private) |
| 21 - (void)registerForNotifications; | 22 - (void)registerForNotifications; |
| 22 - (void)updateOriginFromAnchor; | 23 - (void)updateOriginFromAnchor; |
| 23 - (void)activateTabWithContents:(content::WebContents*)newContents | 24 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 24 previousContents:(content::WebContents*)oldContents | 25 previousContents:(content::WebContents*)oldContents |
| 25 atIndex:(NSInteger)index | 26 atIndex:(NSInteger)index |
| 26 reason:(int)reason; | 27 reason:(int)reason; |
| 27 - (void)recordAnchorOffset; | 28 - (void)recordAnchorOffset; |
| 28 - (void)parentWindowDidResize:(NSNotification*)notification; | 29 - (void)parentWindowDidResize:(NSNotification*)notification; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 62 } |
| 62 | 63 |
| 63 - (id)initWithWindowNibPath:(NSString*)nibPath | 64 - (id)initWithWindowNibPath:(NSString*)nibPath |
| 64 relativeToView:(NSView*)view | 65 relativeToView:(NSView*)view |
| 65 offset:(NSPoint)offset { | 66 offset:(NSPoint)offset { |
| 66 DCHECK([view window]); | 67 DCHECK([view window]); |
| 67 NSWindow* window = [view window]; | 68 NSWindow* window = [view window]; |
| 68 NSRect bounds = [view convertRect:[view bounds] toView:nil]; | 69 NSRect bounds = [view convertRect:[view bounds] toView:nil]; |
| 69 NSPoint anchor = NSMakePoint(NSMinX(bounds) + offset.x, | 70 NSPoint anchor = NSMakePoint(NSMinX(bounds) + offset.x, |
| 70 NSMinY(bounds) + offset.y); | 71 NSMinY(bounds) + offset.y); |
| 71 anchor = [window convertBaseToScreen:anchor]; | 72 anchor = ui::ConvertPointFromWindowToScreen(window, anchor); |
| 72 return [self initWithWindowNibPath:nibPath | 73 return [self initWithWindowNibPath:nibPath |
| 73 parentWindow:window | 74 parentWindow:window |
| 74 anchoredAt:anchor]; | 75 anchoredAt:anchor]; |
| 75 } | 76 } |
| 76 | 77 |
| 77 - (id)initWithWindow:(NSWindow*)theWindow | 78 - (id)initWithWindow:(NSWindow*)theWindow |
| 78 parentWindow:(NSWindow*)parentWindow | 79 parentWindow:(NSWindow*)parentWindow |
| 79 anchoredAt:(NSPoint)anchoredAt { | 80 anchoredAt:(NSPoint)anchoredAt { |
| 80 DCHECK(theWindow); | 81 DCHECK(theWindow); |
| 81 if ((self = [super initWithWindow:theWindow])) { | 82 if ((self = [super initWithWindow:theWindow])) { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 448 |
| 448 - (void)activateTabWithContents:(content::WebContents*)newContents | 449 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 449 previousContents:(content::WebContents*)oldContents | 450 previousContents:(content::WebContents*)oldContents |
| 450 atIndex:(NSInteger)index | 451 atIndex:(NSInteger)index |
| 451 reason:(int)reason { | 452 reason:(int)reason { |
| 452 // The user switched tabs; close. | 453 // The user switched tabs; close. |
| 453 [self closeBubble]; | 454 [self closeBubble]; |
| 454 } | 455 } |
| 455 | 456 |
| 456 @end // BaseBubbleController | 457 @end // BaseBubbleController |
| OLD | NEW |