| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 void BrowserWindowCocoa::Restore() { | 333 void BrowserWindowCocoa::Restore() { |
| 334 if (IsMaximized()) | 334 if (IsMaximized()) |
| 335 [window() zoom:controller_]; // Toggles zoom mode. | 335 [window() zoom:controller_]; // Toggles zoom mode. |
| 336 else if (IsMinimized()) | 336 else if (IsMinimized()) |
| 337 [window() deminiaturize:controller_]; | 337 [window() deminiaturize:controller_]; |
| 338 } | 338 } |
| 339 | 339 |
| 340 void BrowserWindowCocoa::EnterFullscreen( | 340 void BrowserWindowCocoa::EnterFullscreen( |
| 341 const GURL& url, FullscreenExitBubbleType bubble_type) { | 341 const GURL& url, FullscreenExitBubbleType bubble_type) { |
| 342 [controller_ enterFullscreenForURL:url | 342 [controller_ enterPresentationModeForURL:url |
| 343 bubbleType:bubble_type]; | 343 bubbleType:bubble_type]; |
| 344 } | 344 } |
| 345 | 345 |
| 346 void BrowserWindowCocoa::ExitFullscreen() { | 346 void BrowserWindowCocoa::ExitFullscreen() { |
| 347 [controller_ exitFullscreen]; | 347 [controller_ exitFullscreen]; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( | 350 void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent( |
| 351 const GURL& url, | 351 const GURL& url, |
| 352 FullscreenExitBubbleType bubble_type) { | 352 FullscreenExitBubbleType bubble_type) { |
| 353 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; | 353 [controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type]; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool BrowserWindowCocoa::IsFullscreen() const { | 356 bool BrowserWindowCocoa::IsFullscreen() const { |
| 357 if ([controller_ inPresentationMode]) |
| 358 CHECK([controller_ isFullscreen]); // Presentation mode must be fullscreen. |
| 357 return [controller_ isFullscreen]; | 359 return [controller_ isFullscreen]; |
| 358 } | 360 } |
| 359 | 361 |
| 360 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { | 362 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { |
| 361 return false; | 363 return false; |
| 362 } | 364 } |
| 363 | 365 |
| 364 void BrowserWindowCocoa::ConfirmAddSearchProvider( | 366 void BrowserWindowCocoa::ConfirmAddSearchProvider( |
| 365 TemplateURL* template_url, | 367 TemplateURL* template_url, |
| 366 Profile* profile) { | 368 Profile* profile) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 581 } |
| 580 | 582 |
| 581 void BrowserWindowCocoa::Paste() { | 583 void BrowserWindowCocoa::Paste() { |
| 582 [NSApp sendAction:@selector(paste:) to:nil from:nil]; | 584 [NSApp sendAction:@selector(paste:) to:nil from:nil]; |
| 583 } | 585 } |
| 584 | 586 |
| 585 void BrowserWindowCocoa::OpenTabpose() { | 587 void BrowserWindowCocoa::OpenTabpose() { |
| 586 [controller_ openTabpose]; | 588 [controller_ openTabpose]; |
| 587 } | 589 } |
| 588 | 590 |
| 589 void BrowserWindowCocoa::EnterPresentationMode( | 591 void BrowserWindowCocoa::EnterFullscreenWithChrome() { |
| 590 const GURL& url, | 592 CHECK(base::mac::IsOSLionOrLater()); |
| 591 FullscreenExitBubbleType bubble_type) { | 593 if ([controller_ inPresentationMode]) |
| 592 [controller_ enterPresentationModeForURL:url | 594 [controller_ exitPresentationMode]; |
| 593 bubbleType:bubble_type]; | 595 else |
| 596 [controller_ enterFullscreen]; |
| 594 } | 597 } |
| 595 | 598 |
| 596 void BrowserWindowCocoa::ExitPresentationMode() { | 599 bool BrowserWindowCocoa::IsFullscreenWithChrome() { |
| 597 [controller_ exitPresentationMode]; | 600 return IsFullscreen() && ![controller_ inPresentationMode]; |
| 598 } | 601 } |
| 599 | 602 |
| 600 bool BrowserWindowCocoa::InPresentationMode() { | 603 bool BrowserWindowCocoa::IsFullscreenWithoutChrome() { |
| 601 return [controller_ inPresentationMode]; | 604 return IsFullscreen() && [controller_ inPresentationMode]; |
| 602 } | 605 } |
| 603 | 606 |
| 604 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { | 607 gfx::Rect BrowserWindowCocoa::GetInstantBounds() { |
| 605 // Flip coordinates based on the primary screen. | 608 // Flip coordinates based on the primary screen. |
| 606 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 609 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 607 NSRect monitorFrame = [screen frame]; | 610 NSRect monitorFrame = [screen frame]; |
| 608 NSRect frame = [controller_ instantFrame]; | 611 NSRect frame = [controller_ instantFrame]; |
| 609 gfx::Rect bounds(NSRectToCGRect(frame)); | 612 gfx::Rect bounds(NSRectToCGRect(frame)); |
| 610 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); | 613 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); |
| 611 return bounds; | 614 return bounds; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 PasswordGenerationBubbleController* controller = | 693 PasswordGenerationBubbleController* controller = |
| 691 [[PasswordGenerationBubbleController alloc] | 694 [[PasswordGenerationBubbleController alloc] |
| 692 initWithWindow:browser_->window()->GetNativeWindow() | 695 initWithWindow:browser_->window()->GetNativeWindow() |
| 693 anchoredAt:point | 696 anchoredAt:point |
| 694 renderViewHost:web_contents->GetRenderViewHost() | 697 renderViewHost:web_contents->GetRenderViewHost() |
| 695 passwordManager:PasswordManager::FromWebContents(web_contents) | 698 passwordManager:PasswordManager::FromWebContents(web_contents) |
| 696 usingGenerator:password_generator | 699 usingGenerator:password_generator |
| 697 forForm:form]; | 700 forForm:form]; |
| 698 [controller showWindow:nil]; | 701 [controller showWindow:nil]; |
| 699 } | 702 } |
| OLD | NEW |