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 (!g_browser_process || !g_browser_process->local_state() || | 65 if (!browser_->profile()->GetPrefs() || |
66 !browser_->ShouldSaveWindowPlacement()) | 66 !browser_->ShouldSaveWindowPlacement()) { |
67 return; | 67 return; |
| 68 } |
68 | 69 |
69 [self saveWindowPositionToPrefs:g_browser_process->local_state()]; | 70 [self saveWindowPositionToPrefs:browser_->profile()->GetPrefs()]; |
70 } | 71 } |
71 | 72 |
72 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { | 73 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { |
73 // If we're in fullscreen mode, save the position of the regular window | 74 // If we're in fullscreen mode, save the position of the regular window |
74 // instead. | 75 // instead. |
75 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; | 76 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; |
76 | 77 |
77 // Window positions are stored relative to the origin of the primary monitor. | 78 // Window positions are stored relative to the origin of the primary monitor. |
78 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; | 79 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; |
79 NSScreen* windowScreen = [window screen]; | 80 NSScreen* windowScreen = [window screen]; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 - (void)disableBarVisibilityUpdates { | 499 - (void)disableBarVisibilityUpdates { |
499 // Early escape if there's nothing to do. | 500 // Early escape if there's nothing to do. |
500 if (!barVisibilityUpdatesEnabled_) | 501 if (!barVisibilityUpdatesEnabled_) |
501 return; | 502 return; |
502 | 503 |
503 barVisibilityUpdatesEnabled_ = NO; | 504 barVisibilityUpdatesEnabled_ = NO; |
504 [fullscreenController_ cancelAnimationAndTimers]; | 505 [fullscreenController_ cancelAnimationAndTimers]; |
505 } | 506 } |
506 | 507 |
507 @end // @implementation BrowserWindowController(Private) | 508 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |