| 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // (bounded by available width). | 689 // (bounded by available width). |
| 690 const CGFloat kProportion = 0.6; | 690 const CGFloat kProportion = 0.6; |
| 691 CGFloat zoomedWidth = | 691 CGFloat zoomedWidth = |
| 692 std::max(kProportion * frame.size.width, | 692 std::max(kProportion * frame.size.width, |
| 693 std::min(kProportion * frame.size.height, frame.size.width)); | 693 std::min(kProportion * frame.size.height, frame.size.width)); |
| 694 | 694 |
| 695 WebContents* contents = browser_->GetSelectedWebContents(); | 695 WebContents* contents = browser_->GetSelectedWebContents(); |
| 696 if (contents) { | 696 if (contents) { |
| 697 // If the intrinsic width is bigger, then make it the zoomed width. | 697 // If the intrinsic width is bigger, then make it the zoomed width. |
| 698 const int kScrollbarWidth = 16; // TODO(viettrungluu): ugh. | 698 const int kScrollbarWidth = 16; // TODO(viettrungluu): ugh. |
| 699 TabContentsViewMac* tab_contents_view = | |
| 700 static_cast<TabContentsViewMac*>(contents->GetView()); | |
| 701 CGFloat intrinsicWidth = static_cast<CGFloat>( | 699 CGFloat intrinsicWidth = static_cast<CGFloat>( |
| 702 tab_contents_view->preferred_width() + kScrollbarWidth); | 700 contents->GetPreferredSize().width() + kScrollbarWidth); |
| 703 zoomedWidth = std::max(zoomedWidth, | 701 zoomedWidth = std::max(zoomedWidth, |
| 704 std::min(intrinsicWidth, frame.size.width)); | 702 std::min(intrinsicWidth, frame.size.width)); |
| 705 } | 703 } |
| 706 | 704 |
| 707 // Never shrink from the current size on zoom (see above). | 705 // Never shrink from the current size on zoom (see above). |
| 708 NSRect currentFrame = [[self window] frame]; | 706 NSRect currentFrame = [[self window] frame]; |
| 709 zoomedWidth = std::max(zoomedWidth, currentFrame.size.width); | 707 zoomedWidth = std::max(zoomedWidth, currentFrame.size.width); |
| 710 | 708 |
| 711 // |frame| determines our maximum extents. We need to set the origin of the | 709 // |frame| determines our maximum extents. We need to set the origin of the |
| 712 // frame -- and only move it left if necessary. | 710 // frame -- and only move it left if necessary. |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 | 2166 |
| 2169 - (BOOL)supportsBookmarkBar { | 2167 - (BOOL)supportsBookmarkBar { |
| 2170 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2168 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2171 } | 2169 } |
| 2172 | 2170 |
| 2173 - (BOOL)isTabbedWindow { | 2171 - (BOOL)isTabbedWindow { |
| 2174 return browser_->is_type_tabbed(); | 2172 return browser_->is_type_tabbed(); |
| 2175 } | 2173 } |
| 2176 | 2174 |
| 2177 @end // @implementation BrowserWindowController(WindowType) | 2175 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |