| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 298 } |
| 299 | 299 |
| 300 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { | 300 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { |
| 301 // Do nothing on Mac. | 301 // Do nothing on Mac. |
| 302 } | 302 } |
| 303 | 303 |
| 304 void BrowserWindowCocoa::SetStarredState(bool is_starred) { | 304 void BrowserWindowCocoa::SetStarredState(bool is_starred) { |
| 305 [controller_ setStarredState:is_starred ? YES : NO]; | 305 [controller_ setStarredState:is_starred ? YES : NO]; |
| 306 } | 306 } |
| 307 | 307 |
| 308 void BrowserWindowCocoa::OnActiveTabChanged(content::WebContents* old_contents, |
| 309 content::WebContents* new_contents, |
| 310 int index, |
| 311 int reason) { |
| 312 // TODO(pkasting): Perhaps the code in |
| 313 // TabStripController::activateTabWithContents should move here? Or this |
| 314 // should call that (instead of TabStripModelObserverBridge doing so)? It's |
| 315 // not obvious to me why Mac doesn't handle tab changes in BrowserWindow the |
| 316 // way views and GTK do. |
| 317 } |
| 318 |
| 308 void BrowserWindowCocoa::ZoomChangedForActiveTab(bool can_show_bubble) { | 319 void BrowserWindowCocoa::ZoomChangedForActiveTab(bool can_show_bubble) { |
| 309 [controller_ zoomChangedForActiveTab:can_show_bubble ? YES : NO]; | 320 [controller_ zoomChangedForActiveTab:can_show_bubble ? YES : NO]; |
| 310 } | 321 } |
| 311 | 322 |
| 312 gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const { | 323 gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const { |
| 313 // Flip coordinates based on the primary screen. | 324 // Flip coordinates based on the primary screen. |
| 314 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 325 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 315 NSRect frame = [controller_ regularWindowFrame]; | 326 NSRect frame = [controller_ regularWindowFrame]; |
| 316 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 327 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
| 317 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 328 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 // further, both by another H, i.e. WebContentsView's height becomes | 773 // further, both by another H, i.e. WebContentsView's height becomes |
| 763 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. | 774 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. |
| 764 // Strangely, the RenderWidgetHostView for the previous navigation entry also | 775 // Strangely, the RenderWidgetHostView for the previous navigation entry also |
| 765 // gets enlarged by H. | 776 // gets enlarged by H. |
| 766 // I believe these "automatic" resizing are caused by setAutoresizingMask of | 777 // I believe these "automatic" resizing are caused by setAutoresizingMask of |
| 767 // of the cocoa view in WebContentsViewMac, which defeats the purpose of | 778 // of the cocoa view in WebContentsViewMac, which defeats the purpose of |
| 768 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of | 779 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of |
| 769 // RenderWidgetHostView in (2) and (3). | 780 // RenderWidgetHostView in (2) and (3). |
| 770 return 0; | 781 return 0; |
| 771 } | 782 } |
| OLD | NEW |