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/mac/scoped_nsobject.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 13 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_info_util.h" | 15 #include "chrome/browser/profiles/profile_info_util.h" |
16 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
17 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_window_state.h" | 19 #include "chrome/browser/ui/browser_window_state.h" |
20 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 20 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 545 |
546 NSWindow* sourceWindow = fullscreen ? regularWindow : fullscreenWindow; | 546 NSWindow* sourceWindow = fullscreen ? regularWindow : fullscreenWindow; |
547 NSWindow* destWindow = fullscreen ? fullscreenWindow : regularWindow; | 547 NSWindow* destWindow = fullscreen ? fullscreenWindow : regularWindow; |
548 | 548 |
549 // Close the bookmark bubble, if it's open. Use |-ok:| instead of |-cancel:| | 549 // Close the bookmark bubble, if it's open. Use |-ok:| instead of |-cancel:| |
550 // or |-close| because that matches the behavior when the bubble loses key | 550 // or |-close| because that matches the behavior when the bubble loses key |
551 // status. | 551 // status. |
552 [bookmarkBubbleController_ ok:self]; | 552 [bookmarkBubbleController_ ok:self]; |
553 | 553 |
554 // Save the current first responder so we can restore after views are moved. | 554 // Save the current first responder so we can restore after views are moved. |
555 scoped_nsobject<FocusTracker> focusTracker( | 555 base::scoped_nsobject<FocusTracker> focusTracker( |
556 [[FocusTracker alloc] initWithWindow:sourceWindow]); | 556 [[FocusTracker alloc] initWithWindow:sourceWindow]); |
557 | 557 |
558 // While we move views (and focus) around, disable any bar visibility changes. | 558 // While we move views (and focus) around, disable any bar visibility changes. |
559 [self disableBarVisibilityUpdates]; | 559 [self disableBarVisibilityUpdates]; |
560 | 560 |
561 // Retain the tab strip view while we remove it from its superview. | 561 // Retain the tab strip view while we remove it from its superview. |
562 scoped_nsobject<NSView> tabStripView; | 562 base::scoped_nsobject<NSView> tabStripView; |
563 if ([self hasTabStrip]) { | 563 if ([self hasTabStrip]) { |
564 tabStripView.reset([[self tabStripView] retain]); | 564 tabStripView.reset([[self tabStripView] retain]); |
565 [tabStripView removeFromSuperview]; | 565 [tabStripView removeFromSuperview]; |
566 } | 566 } |
567 | 567 |
568 // Ditto for the content view. | 568 // Ditto for the content view. |
569 scoped_nsobject<NSView> contentView([[sourceWindow contentView] retain]); | 569 base::scoped_nsobject<NSView> contentView( |
| 570 [[sourceWindow contentView] retain]); |
570 // Disable autoresizing of subviews while we move views around. This prevents | 571 // Disable autoresizing of subviews while we move views around. This prevents |
571 // spurious renderer resizes. | 572 // spurious renderer resizes. |
572 [contentView setAutoresizesSubviews:NO]; | 573 [contentView setAutoresizesSubviews:NO]; |
573 [contentView removeFromSuperview]; | 574 [contentView removeFromSuperview]; |
574 | 575 |
575 // Have to do this here, otherwise later calls can crash because the window | 576 // Have to do this here, otherwise later calls can crash because the window |
576 // has no delegate. | 577 // has no delegate. |
577 [sourceWindow setDelegate:nil]; | 578 [sourceWindow setDelegate:nil]; |
578 [destWindow setDelegate:self]; | 579 [destWindow setDelegate:self]; |
579 | 580 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 - (void)updateInfoBarTipVisibility { | 1054 - (void)updateInfoBarTipVisibility { |
1054 // If the overlay is open or if there's no toolbar then hide the infobar tip. | 1055 // If the overlay is open or if there's no toolbar then hide the infobar tip. |
1055 BOOL suppressInfoBarTip = | 1056 BOOL suppressInfoBarTip = |
1056 [self currentInstantUIState] != | 1057 [self currentInstantUIState] != |
1057 browser_window_controller::kInstantUINone || ![self hasToolbar]; | 1058 browser_window_controller::kInstantUINone || ![self hasToolbar]; |
1058 [infoBarContainerController_ | 1059 [infoBarContainerController_ |
1059 setShouldSuppressTopInfoBarTip:suppressInfoBarTip]; | 1060 setShouldSuppressTopInfoBarTip:suppressInfoBarTip]; |
1060 } | 1061 } |
1061 | 1062 |
1062 @end // @implementation BrowserWindowController(Private) | 1063 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |