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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 forWindow:window()]); | 220 forWindow:window()]); |
221 } | 221 } |
222 | 222 |
223 void BrowserWindowCocoa::BookmarkBarStateChanged( | 223 void BrowserWindowCocoa::BookmarkBarStateChanged( |
224 BookmarkBar::AnimateChangeType change_type) { | 224 BookmarkBar::AnimateChangeType change_type) { |
225 // TODO: route changes to state through this. | 225 // TODO: route changes to state through this. |
226 } | 226 } |
227 | 227 |
228 void BrowserWindowCocoa::UpdateDevTools() { | 228 void BrowserWindowCocoa::UpdateDevTools() { |
229 [controller_ updateDevToolsForContents: | 229 [controller_ updateDevToolsForContents: |
230 browser_->GetSelectedTabContents()]; | 230 browser_->GetSelectedWebContents()]; |
231 } | 231 } |
232 | 232 |
233 void BrowserWindowCocoa::SetDevToolsDockSide(DevToolsDockSide side) { | 233 void BrowserWindowCocoa::SetDevToolsDockSide(DevToolsDockSide side) { |
234 [controller_ setDevToolsDockToRight:side == DEVTOOLS_DOCK_SIDE_RIGHT]; | 234 [controller_ setDevToolsDockToRight:side == DEVTOOLS_DOCK_SIDE_RIGHT]; |
235 } | 235 } |
236 | 236 |
237 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { | 237 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { |
238 // Do nothing on Mac. | 238 // Do nothing on Mac. |
239 } | 239 } |
240 | 240 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 // at this point the controller is dead (autoreleased), so | 603 // at this point the controller is dead (autoreleased), so |
604 // make sure we don't try to reference it any more. | 604 // make sure we don't try to reference it any more. |
605 } | 605 } |
606 | 606 |
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_->GetSelectedWebContents()) { |
613 [controller_ updateSidebarForContents:tab_contents]; | 613 [controller_ updateSidebarForContents:tab_contents]; |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 void BrowserWindowCocoa::ShowAvatarBubble(WebContents* web_contents, | 617 void BrowserWindowCocoa::ShowAvatarBubble(WebContents* web_contents, |
618 const gfx::Rect& rect) { | 618 const gfx::Rect& rect) { |
619 NSView* view = web_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 |