| 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_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 21 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
| 22 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 22 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 23 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 23 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 25 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 25 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 26 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 27 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 27 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
| 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 30 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 30 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 31 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "content/public/browser/render_widget_host_view.h" | 33 #include "content/public/browser/render_widget_host_view.h" |
| 34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/browser/web_contents_view.h" | 35 #include "content/public/browser/web_contents_view.h" |
| 36 #import "ui/base/cocoa/focus_tracker.h" | 36 #import "ui/base/cocoa/focus_tracker.h" |
| 37 #include "ui/base/ui_base_types.h" | 37 #include "ui/base/ui_base_types.h" |
| 38 | 38 |
| 39 using content::RenderWidgetHostView; | 39 using content::RenderWidgetHostView; |
| 40 using content::WebContents; | 40 using content::WebContents; |
| 41 | 41 |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 bool contentShifted = | 518 bool contentShifted = |
| 519 NSMaxY(tabContentFrame) != NSMaxY(newFrame) || | 519 NSMaxY(tabContentFrame) != NSMaxY(newFrame) || |
| 520 NSMinX(tabContentFrame) != NSMinX(newFrame); | 520 NSMinX(tabContentFrame) != NSMinX(newFrame); |
| 521 | 521 |
| 522 tabContentFrame = newFrame; | 522 tabContentFrame = newFrame; |
| 523 [tabContentView setFrame:tabContentFrame]; | 523 [tabContentView setFrame:tabContentFrame]; |
| 524 | 524 |
| 525 // If the relayout shifts the content area up or down, let the renderer know. | 525 // If the relayout shifts the content area up or down, let the renderer know. |
| 526 if (contentShifted) { | 526 if (contentShifted) { |
| 527 if (WebContents* contents = browser_->GetSelectedWebContents()) { | 527 if (WebContents* contents = browser_->GetActiveWebContents()) { |
| 528 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) | 528 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
| 529 rwhv->WindowFrameChanged(); | 529 rwhv->WindowFrameChanged(); |
| 530 } | 530 } |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 - (BOOL)shouldShowBookmarkBar { | 534 - (BOOL)shouldShowBookmarkBar { |
| 535 DCHECK(browser_.get()); | 535 DCHECK(browser_.get()); |
| 536 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? | 536 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? |
| 537 YES : NO; | 537 YES : NO; |
| 538 } | 538 } |
| 539 | 539 |
| 540 - (BOOL)shouldShowDetachedBookmarkBar { | 540 - (BOOL)shouldShowDetachedBookmarkBar { |
| 541 DCHECK(browser_.get()); | 541 DCHECK(browser_.get()); |
| 542 TabContentsWrapper* tab = browser_->GetSelectedTabContentsWrapper(); | 542 TabContents* tab = browser_->GetActiveTabContents(); |
| 543 return (tab && tab->bookmark_tab_helper()->ShouldShowBookmarkBar() && | 543 return (tab && tab->bookmark_tab_helper()->ShouldShowBookmarkBar() && |
| 544 ![previewableContentsController_ isShowingPreview]); | 544 ![previewableContentsController_ isShowingPreview]); |
| 545 } | 545 } |
| 546 | 546 |
| 547 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression { | 547 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression { |
| 548 CGFloat newHeight = | 548 CGFloat newHeight = |
| 549 [toolbarController_ desiredHeightForCompression:compression]; | 549 [toolbarController_ desiredHeightForCompression:compression]; |
| 550 NSRect toolbarFrame = [[toolbarController_ view] frame]; | 550 NSRect toolbarFrame = [[toolbarController_ view] frame]; |
| 551 CGFloat deltaH = newHeight - toolbarFrame.size.height; | 551 CGFloat deltaH = newHeight - toolbarFrame.size.height; |
| 552 | 552 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 - (void)disableBarVisibilityUpdates { | 903 - (void)disableBarVisibilityUpdates { |
| 904 // Early escape if there's nothing to do. | 904 // Early escape if there's nothing to do. |
| 905 if (!barVisibilityUpdatesEnabled_) | 905 if (!barVisibilityUpdatesEnabled_) |
| 906 return; | 906 return; |
| 907 | 907 |
| 908 barVisibilityUpdatesEnabled_ = NO; | 908 barVisibilityUpdatesEnabled_ = NO; |
| 909 [presentationModeController_ cancelAnimationAndTimers]; | 909 [presentationModeController_ cancelAnimationAndTimers]; |
| 910 } | 910 } |
| 911 | 911 |
| 912 @end // @implementation BrowserWindowController(Private) | 912 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |