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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 NSWindow* BrowserWindowCocoa::window() const { | 607 NSWindow* BrowserWindowCocoa::window() const { |
608 return [controller_ window]; | 608 return [controller_ window]; |
609 } | 609 } |
610 | 610 |
611 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 611 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
612 if (tab_contents == browser_->GetSelectedTabContents()) { | 612 if (tab_contents == browser_->GetSelectedTabContents()) { |
613 [controller_ updateSidebarForContents:tab_contents]; | 613 [controller_ updateSidebarForContents:tab_contents]; |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 void BrowserWindowCocoa::ShowAvatarBubble(TabContents* tab_contents, | 617 void BrowserWindowCocoa::ShowAvatarBubble(WebContents* web_contents, |
618 const gfx::Rect& rect) { | 618 const gfx::Rect& rect) { |
619 NSView* view = tab_contents->GetNativeView(); | 619 NSView* view = web_contents->GetNativeView(); |
620 NSRect bounds = [view bounds]; | 620 NSRect bounds = [view bounds]; |
621 NSPoint point; | 621 NSPoint point; |
622 point.x = NSMinX(bounds) + rect.right(); | 622 point.x = NSMinX(bounds) + rect.right(); |
623 // The view's origin is at the bottom but |rect|'s origin is at the top. | 623 // The view's origin is at the bottom but |rect|'s origin is at the top. |
624 point.y = NSMaxY(bounds) - rect.bottom(); | 624 point.y = NSMaxY(bounds) - rect.bottom(); |
625 point = [view convertPoint:point toView:nil]; | 625 point = [view convertPoint:point toView:nil]; |
626 point = [[view window] convertBaseToScreen:point]; | 626 point = [[view window] convertBaseToScreen:point]; |
627 | 627 |
628 // |menu| will automatically release itself on close. | 628 // |menu| will automatically release itself on close. |
629 AvatarMenuBubbleController* menu = | 629 AvatarMenuBubbleController* menu = |
630 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 630 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
631 anchoredAt:point]; | 631 anchoredAt:point]; |
632 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 632 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
633 [menu showWindow:nil]; | 633 [menu showWindow:nil]; |
634 } | 634 } |
635 | 635 |
636 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 636 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
637 [[controller_ avatarButtonController] showAvatarBubble]; | 637 [[controller_ avatarButtonController] showAvatarBubble]; |
638 } | 638 } |
OLD | NEW |