| OLD | NEW |
| 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/ui/cocoa/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #import "base/scoped_nsobject.h" | 7 #import "base/scoped_nsobject.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 initWithView:[self tabStripView] | 55 initWithView:[self tabStripView] |
| 56 switchView:[previewableContentsController_ activeContainer] | 56 switchView:[previewableContentsController_ activeContainer] |
| 57 browser:browser_.get() | 57 browser:browser_.get() |
| 58 delegate:self]); | 58 delegate:self]); |
| 59 } | 59 } |
| 60 | 60 |
| 61 - (void)saveWindowPositionIfNeeded { | 61 - (void)saveWindowPositionIfNeeded { |
| 62 if (browser_ != BrowserList::GetLastActive()) | 62 if (browser_ != BrowserList::GetLastActive()) |
| 63 return; | 63 return; |
| 64 | 64 |
| 65 if (!browser_->profile()->GetPrefs() || | 65 if (!g_browser_process || !g_browser_process->local_state() || |
| 66 !browser_->ShouldSaveWindowPlacement()) { | 66 !browser_->ShouldSaveWindowPlacement()) |
| 67 return; | 67 return; |
| 68 } | |
| 69 | 68 |
| 70 [self saveWindowPositionToPrefs:browser_->profile()->GetPrefs()]; | 69 [self saveWindowPositionToPrefs:g_browser_process->local_state()]; |
| 71 } | 70 } |
| 72 | 71 |
| 73 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { | 72 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { |
| 74 // If we're in fullscreen mode, save the position of the regular window | 73 // If we're in fullscreen mode, save the position of the regular window |
| 75 // instead. | 74 // instead. |
| 76 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; | 75 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; |
| 77 | 76 |
| 78 // Window positions are stored relative to the origin of the primary monitor. | 77 // Window positions are stored relative to the origin of the primary monitor. |
| 79 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; | 78 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; |
| 80 NSScreen* windowScreen = [window screen]; | 79 NSScreen* windowScreen = [window screen]; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 - (void)disableBarVisibilityUpdates { | 498 - (void)disableBarVisibilityUpdates { |
| 500 // Early escape if there's nothing to do. | 499 // Early escape if there's nothing to do. |
| 501 if (!barVisibilityUpdatesEnabled_) | 500 if (!barVisibilityUpdatesEnabled_) |
| 502 return; | 501 return; |
| 503 | 502 |
| 504 barVisibilityUpdatesEnabled_ = NO; | 503 barVisibilityUpdatesEnabled_ = NO; |
| 505 [fullscreenController_ cancelAnimationAndTimers]; | 504 [fullscreenController_ cancelAnimationAndTimers]; |
| 506 } | 505 } |
| 507 | 506 |
| 508 @end // @implementation BrowserWindowController(Private) | 507 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |