Chromium Code Reviews| 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 | 519 |
| 520 // TODO: add support for |instant_is_active|. | 520 // TODO: add support for |instant_is_active|. |
|
sreeram
2011/10/14 20:07:32
Remove this todo?
| |
| 521 } | 521 } |
| 522 | 522 |
| 523 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { | 523 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { |
| 524 // Flip coordinates based on the primary screen. | 524 // Flip coordinates based on the primary screen. |
| 525 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 525 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 526 NSRect monitorFrame = [screen frame]; | 526 NSRect monitorFrame = [screen frame]; |
| 527 NSRect frame = [controller_ instantFrame]; | 527 NSRect frame = [controller_ instantFrame]; |
| 528 gfx::Rect bounds(NSRectToCGRect(frame)); | 528 gfx::Rect bounds(NSRectToCGRect(frame)); |
| 529 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); | 529 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); |
| 530 return bounds; | 530 return bounds; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 point.y = NSMaxY(bounds) - rect.bottom(); | 592 point.y = NSMaxY(bounds) - rect.bottom(); |
| 593 point = [view convertPoint:point toView:nil]; | 593 point = [view convertPoint:point toView:nil]; |
| 594 point = [[view window] convertBaseToScreen:point]; | 594 point = [[view window] convertBaseToScreen:point]; |
| 595 | 595 |
| 596 // |menu| will automatically release itself on close. | 596 // |menu| will automatically release itself on close. |
| 597 AvatarMenuBubbleController* menu = | 597 AvatarMenuBubbleController* menu = |
| 598 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 598 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
| 599 anchoredAt:point]; | 599 anchoredAt:point]; |
| 600 [menu showWindow:nil]; | 600 [menu showWindow:nil]; |
| 601 } | 601 } |
| OLD | NEW |