Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 3828009: Move scoped_nsdisable_screen_update from base to app/mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/browser_frame_view.mm ('k') | chrome/browser/cocoa/cocoa_test_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/browser_window_controller.h" 5 #import "chrome/browser/cocoa/browser_window_controller.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/l10n_util_mac.h" 10 #include "app/l10n_util_mac.h"
11 #include "base/mac_util.h" 11 #include "base/mac_util.h"
12 #include "app/mac/scoped_nsdisable_screen_updates.h"
12 #include "base/nsimage_cache_mac.h" 13 #include "base/nsimage_cache_mac.h"
13 #include "base/scoped_nsdisable_screen_updates.h"
14 #import "base/scoped_nsobject.h" 14 #import "base/scoped_nsobject.h"
15 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
16 #include "chrome/app/chrome_dll_resource.h" // IDC_* 16 #include "chrome/app/chrome_dll_resource.h" // IDC_*
17 #include "chrome/browser/bookmarks/bookmark_editor.h" 17 #include "chrome/browser/bookmarks/bookmark_editor.h"
18 #include "chrome/browser/browser.h" 18 #include "chrome/browser/browser.h"
19 #include "chrome/browser/browser_list.h" 19 #include "chrome/browser/browser_list.h"
20 #import "chrome/browser/cocoa/background_gradient_view.h" 20 #import "chrome/browser/cocoa/background_gradient_view.h"
21 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_controller.h" 21 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_controller.h"
22 #import "chrome/browser/cocoa/bookmarks/bookmark_editor_controller.h" 22 #import "chrome/browser/cocoa/bookmarks/bookmark_editor_controller.h"
23 #import "chrome/browser/cocoa/browser_window_cocoa.h" 23 #import "chrome/browser/cocoa/browser_window_cocoa.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 449 }
450 450
451 // Called when the user wants to close a window or from the shutdown process. 451 // Called when the user wants to close a window or from the shutdown process.
452 // The Browser object is in control of whether or not we're allowed to close. It 452 // The Browser object is in control of whether or not we're allowed to close. It
453 // may defer closing due to several states, such as onUnload handlers needing to 453 // may defer closing due to several states, such as onUnload handlers needing to
454 // be fired. If closing is deferred, the Browser will handle the processing 454 // be fired. If closing is deferred, the Browser will handle the processing
455 // required to get us to the closing state and (by watching for all the tabs 455 // required to get us to the closing state and (by watching for all the tabs
456 // going away) will again call to close the window when it's finally ready. 456 // going away) will again call to close the window when it's finally ready.
457 - (BOOL)windowShouldClose:(id)sender { 457 - (BOOL)windowShouldClose:(id)sender {
458 // Disable updates while closing all tabs to avoid flickering. 458 // Disable updates while closing all tabs to avoid flickering.
459 base::ScopedNSDisableScreenUpdates disabler; 459 app::mac::ScopedNSDisableScreenUpdates disabler;
460 // Give beforeunload handlers the chance to cancel the close before we hide 460 // Give beforeunload handlers the chance to cancel the close before we hide
461 // the window below. 461 // the window below.
462 if (!browser_->ShouldCloseWindow()) 462 if (!browser_->ShouldCloseWindow())
463 return NO; 463 return NO;
464 464
465 // saveWindowPositionIfNeeded: only works if we are the last active 465 // saveWindowPositionIfNeeded: only works if we are the last active
466 // window, but orderOut: ends up activating another window, so we 466 // window, but orderOut: ends up activating another window, so we
467 // have to save the window position before we call orderOut:. 467 // have to save the window position before we call orderOut:.
468 [self saveWindowPositionIfNeeded]; 468 [self saveWindowPositionIfNeeded];
469 469
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 - (void)focusTabContents { 1167 - (void)focusTabContents {
1168 [[self window] makeFirstResponder:[tabStripController_ selectedTabView]]; 1168 [[self window] makeFirstResponder:[tabStripController_ selectedTabView]];
1169 } 1169 }
1170 1170
1171 - (void)layoutTabs { 1171 - (void)layoutTabs {
1172 [tabStripController_ layoutTabs]; 1172 [tabStripController_ layoutTabs];
1173 } 1173 }
1174 1174
1175 - (TabWindowController*)detachTabToNewWindow:(TabView*)tabView { 1175 - (TabWindowController*)detachTabToNewWindow:(TabView*)tabView {
1176 // Disable screen updates so that this appears as a single visual change. 1176 // Disable screen updates so that this appears as a single visual change.
1177 base::ScopedNSDisableScreenUpdates disabler; 1177 app::mac::ScopedNSDisableScreenUpdates disabler;
1178 1178
1179 // Fetch the tab contents for the tab being dragged. 1179 // Fetch the tab contents for the tab being dragged.
1180 int index = [tabStripController_ modelIndexForTabView:tabView]; 1180 int index = [tabStripController_ modelIndexForTabView:tabView];
1181 TabContents* contents = browser_->tabstrip_model()->GetTabContentsAt(index); 1181 TabContents* contents = browser_->tabstrip_model()->GetTabContentsAt(index);
1182 1182
1183 // Set the window size. Need to do this before we detach the tab so it's 1183 // Set the window size. Need to do this before we detach the tab so it's
1184 // still in the window. We have to flip the coordinates as that's what 1184 // still in the window. We have to flip the coordinates as that's what
1185 // is expected by the Browser code. 1185 // is expected by the Browser code.
1186 NSWindow* sourceWindow = [tabView window]; 1186 NSWindow* sourceWindow = [tabView window];
1187 NSRect windowRect = [sourceWindow frame]; 1187 NSRect windowRect = [sourceWindow frame];
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 2010
2011 - (BOOL)supportsBookmarkBar { 2011 - (BOOL)supportsBookmarkBar {
2012 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2012 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2013 } 2013 }
2014 2014
2015 - (BOOL)isNormalWindow { 2015 - (BOOL)isNormalWindow {
2016 return browser_->type() == Browser::TYPE_NORMAL; 2016 return browser_->type() == Browser::TYPE_NORMAL;
2017 } 2017 }
2018 2018
2019 @end // @implementation BrowserWindowController(WindowType) 2019 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_frame_view.mm ('k') | chrome/browser/cocoa/cocoa_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698