Chromium Code Reviews| 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 #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/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 | 329 |
| 330 void BrowserWindowCocoa::Restore() { | 330 void BrowserWindowCocoa::Restore() { |
| 331 if (IsMaximized()) | 331 if (IsMaximized()) |
| 332 [window() zoom:controller_]; // Toggles zoom mode. | 332 [window() zoom:controller_]; // Toggles zoom mode. |
| 333 else if (IsMinimized()) | 333 else if (IsMinimized()) |
| 334 [window() deminiaturize:controller_]; | 334 [window() deminiaturize:controller_]; |
| 335 } | 335 } |
| 336 | 336 |
| 337 void BrowserWindowCocoa::EnterFullscreen( | 337 void BrowserWindowCocoa::EnterFullscreen( |
| 338 const GURL& url, FullscreenExitBubbleType bubble_type) { | 338 const GURL& url, FullscreenExitBubbleType bubble_type) { |
| 339 [controller_ enterFullscreenForURL:url | 339 [controller_ enterPresentationModeForURL:url |
|
Robert Sesek
2013/01/18 19:41:35
Why is this switching to enterPresentationMode? Sh
scheib
2013/01/18 22:12:33
The goal is that 'EnterFullscreen' goes to a fulls
Robert Sesek
2013/01/18 22:19:12
Got it and SGTM.
This may need a change in Browse
| |
| 340 bubbleType:bubble_type]; | 340 bubbleType:bubble_type]; |
| 341 } | 341 } |
| 342 | 342 |
| 343 void BrowserWindowCocoa::ExitFullscreen() { | 343 void BrowserWindowCocoa::ExitFullscreen() { |
| 344 [controller_ exitFullscreen]; | 344 [controller_ exitFullscreen]; |
| 345 } | 345 } |
| 346 | 346 |
| 347 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( | 347 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( |
| 348 const GURL& url, | 348 const GURL& url, |
| 349 FullscreenExitBubbleType bubble_type) { | 349 FullscreenExitBubbleType bubble_type) { |
| 350 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; | 350 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; |
| 351 } | 351 } |
| 352 | 352 |
| 353 bool BrowserWindowCocoa::IsFullscreen() const { | 353 bool BrowserWindowCocoa::IsFullscreen() const { |
| 354 if ([controller_ inPresentationMode]) | |
| 355 CHECK([controller_ isFullscreen]); // Presentation mode must be fullscreen. | |
| 354 return [controller_ isFullscreen]; | 356 return [controller_ isFullscreen]; |
| 355 } | 357 } |
| 356 | 358 |
| 357 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { | 359 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { |
| 358 return false; | 360 return false; |
| 359 } | 361 } |
| 360 | 362 |
| 361 void BrowserWindowCocoa::ConfirmAddSearchProvider( | 363 void BrowserWindowCocoa::ConfirmAddSearchProvider( |
| 362 TemplateURL* template_url, | 364 TemplateURL* template_url, |
| 363 Profile* profile) { | 365 Profile* profile) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 } | 586 } |
| 585 | 587 |
| 586 void BrowserWindowCocoa::Paste() { | 588 void BrowserWindowCocoa::Paste() { |
| 587 [NSApp sendAction:@selector(paste:) to:nil from:nil]; | 589 [NSApp sendAction:@selector(paste:) to:nil from:nil]; |
| 588 } | 590 } |
| 589 | 591 |
| 590 void BrowserWindowCocoa::OpenTabpose() { | 592 void BrowserWindowCocoa::OpenTabpose() { |
| 591 [controller_ openTabpose]; | 593 [controller_ openTabpose]; |
| 592 } | 594 } |
| 593 | 595 |
| 594 void BrowserWindowCocoa::EnterPresentationMode( | 596 void BrowserWindowCocoa::EnterFullscreenWithChrome( |
| 595 const GURL& url, | 597 const GURL& url, |
|
Robert Sesek
2013/01/18 19:41:35
Can this URL ever be non-empty? I don't think a we
scheib
2013/01/23 18:13:37
Done.
| |
| 596 FullscreenExitBubbleType bubble_type) { | 598 FullscreenExitBubbleType bubble_type) { |
| 597 [controller_ enterPresentationModeForURL:url | 599 if ([controller_ inPresentationMode]) |
| 598 bubbleType:bubble_type]; | 600 [controller_ exitPresentationMode]; |
| 601 else | |
| 602 [controller_ enterFullscreenForURL:url | |
| 603 bubbleType:bubble_type]; | |
| 599 } | 604 } |
| 600 | 605 |
| 601 void BrowserWindowCocoa::ExitPresentationMode() { | 606 bool BrowserWindowCocoa::IsFullscreenWithChrome() { |
| 602 [controller_ exitPresentationMode]; | 607 return IsFullscreen() && ![controller_ inPresentationMode]; |
| 603 } | 608 } |
| 604 | 609 |
| 605 bool BrowserWindowCocoa::InPresentationMode() { | 610 bool BrowserWindowCocoa::IsFullscreenWithoutChrome() { |
| 606 return [controller_ inPresentationMode]; | 611 return IsFullscreen() && [controller_ inPresentationMode]; |
| 607 } | 612 } |
| 608 | 613 |
| 609 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { | 614 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { |
| 610 // Flip coordinates based on the primary screen. | 615 // Flip coordinates based on the primary screen. |
| 611 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 616 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 612 NSRect monitorFrame = [screen frame]; | 617 NSRect monitorFrame = [screen frame]; |
| 613 NSRect frame = [controller_ instantFrame]; | 618 NSRect frame = [controller_ instantFrame]; |
| 614 gfx::Rect bounds(NSRectToCGRect(frame)); | 619 gfx::Rect bounds(NSRectToCGRect(frame)); |
| 615 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); | 620 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); |
| 616 return bounds; | 621 return bounds; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 PasswordGenerationBubbleController* controller = | 698 PasswordGenerationBubbleController* controller = |
| 694 [[PasswordGenerationBubbleController alloc] | 699 [[PasswordGenerationBubbleController alloc] |
| 695 initWithWindow:browser_->window()->GetNativeWindow() | 700 initWithWindow:browser_->window()->GetNativeWindow() |
| 696 anchoredAt:point | 701 anchoredAt:point |
| 697 renderViewHost:web_contents->GetRenderViewHost() | 702 renderViewHost:web_contents->GetRenderViewHost() |
| 698 passwordManager:PasswordManager::FromWebContents(web_contents) | 703 passwordManager:PasswordManager::FromWebContents(web_contents) |
| 699 usingGenerator:password_generator | 704 usingGenerator:password_generator |
| 700 forForm:form]; | 705 forForm:form]; |
| 701 [controller showWindow:nil]; | 706 [controller showWindow:nil]; |
| 702 } | 707 } |
| OLD | NEW |