| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 507 } |
| 508 | 508 |
| 509 bool BrowserWindowCocoa::InPresentationMode() { | 509 bool BrowserWindowCocoa::InPresentationMode() { |
| 510 return [controller_ inPresentationMode]; | 510 return [controller_ inPresentationMode]; |
| 511 } | 511 } |
| 512 | 512 |
| 513 void BrowserWindowCocoa::ShowInstant(TabContentsWrapper* preview) { | 513 void BrowserWindowCocoa::ShowInstant(TabContentsWrapper* preview) { |
| 514 [controller_ showInstant:preview->tab_contents()]; | 514 [controller_ showInstant:preview->tab_contents()]; |
| 515 } | 515 } |
| 516 | 516 |
| 517 void BrowserWindowCocoa::HideInstant(bool instant_is_active) { | 517 void BrowserWindowCocoa::HideInstant() { |
| 518 [controller_ hideInstant]; | 518 [controller_ hideInstant]; |
| 519 | |
| 520 // TODO: add support for |instant_is_active|. | |
| 521 } | 519 } |
| 522 | 520 |
| 523 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { | 521 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { |
| 524 // Flip coordinates based on the primary screen. | 522 // Flip coordinates based on the primary screen. |
| 525 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 523 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 526 NSRect monitorFrame = [screen frame]; | 524 NSRect monitorFrame = [screen frame]; |
| 527 NSRect frame = [controller_ instantFrame]; | 525 NSRect frame = [controller_ instantFrame]; |
| 528 gfx::Rect bounds(NSRectToCGRect(frame)); | 526 gfx::Rect bounds(NSRectToCGRect(frame)); |
| 529 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); | 527 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); |
| 530 return bounds; | 528 return bounds; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 point.y = NSMaxY(bounds) - rect.bottom(); | 590 point.y = NSMaxY(bounds) - rect.bottom(); |
| 593 point = [view convertPoint:point toView:nil]; | 591 point = [view convertPoint:point toView:nil]; |
| 594 point = [[view window] convertBaseToScreen:point]; | 592 point = [[view window] convertBaseToScreen:point]; |
| 595 | 593 |
| 596 // |menu| will automatically release itself on close. | 594 // |menu| will automatically release itself on close. |
| 597 AvatarMenuBubbleController* menu = | 595 AvatarMenuBubbleController* menu = |
| 598 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 596 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
| 599 anchoredAt:point]; | 597 anchoredAt:point]; |
| 600 [menu showWindow:nil]; | 598 [menu showWindow:nil]; |
| 601 } | 599 } |
| OLD | NEW |