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" |
| 11 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 12 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
12 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
13 #include "chrome/browser/tab_contents/tab_contents_view.h" | 14 #include "chrome/browser/tab_contents/tab_contents_view.h" |
14 #include "chrome/browser/themes/browser_theme_provider.h" | 15 #include "chrome/browser/themes/browser_theme_provider.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
17 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 18 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
18 #import "chrome/browser/ui/cocoa/find_bar_cocoa_controller.h" | 19 #import "chrome/browser/ui/cocoa/find_bar_cocoa_controller.h" |
19 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 20 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
20 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 21 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 initWithView:[self tabStripView] | 57 initWithView:[self tabStripView] |
57 switchView:[previewableContentsController_ activeContainer] | 58 switchView:[previewableContentsController_ activeContainer] |
58 browser:browser_.get() | 59 browser:browser_.get() |
59 delegate:self]); | 60 delegate:self]); |
60 } | 61 } |
61 | 62 |
62 - (void)saveWindowPositionIfNeeded { | 63 - (void)saveWindowPositionIfNeeded { |
63 if (browser_ != BrowserList::GetLastActive()) | 64 if (browser_ != BrowserList::GetLastActive()) |
64 return; | 65 return; |
65 | 66 |
66 if (!g_browser_process || !g_browser_process->local_state() || | 67 if (!g_browser_process || !g_browser_process->profile_manager() || |
67 !browser_->ShouldSaveWindowPlacement()) | 68 !browser_->ShouldSaveWindowPlacement()) |
68 return; | 69 return; |
69 | 70 |
70 [self saveWindowPositionToPrefs:g_browser_process->local_state()]; | 71 [self saveWindowPositionToPrefs:g_browser_process->profile_manager()-> |
| 72 GetDefaultProfile()->GetPrefs()]; |
71 } | 73 } |
72 | 74 |
73 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { | 75 - (void)saveWindowPositionToPrefs:(PrefService*)prefs { |
74 // If we're in fullscreen mode, save the position of the regular window | 76 // If we're in fullscreen mode, save the position of the regular window |
75 // instead. | 77 // instead. |
76 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; | 78 NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; |
77 | 79 |
78 // Window positions are stored relative to the origin of the primary monitor. | 80 // Window positions are stored relative to the origin of the primary monitor. |
79 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; | 81 NSRect monitorFrame = [[[NSScreen screens] objectAtIndex:0] frame]; |
80 NSScreen* windowScreen = [window screen]; | 82 NSScreen* windowScreen = [window screen]; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 - (void)disableBarVisibilityUpdates { | 501 - (void)disableBarVisibilityUpdates { |
500 // Early escape if there's nothing to do. | 502 // Early escape if there's nothing to do. |
501 if (!barVisibilityUpdatesEnabled_) | 503 if (!barVisibilityUpdatesEnabled_) |
502 return; | 504 return; |
503 | 505 |
504 barVisibilityUpdatesEnabled_ = NO; | 506 barVisibilityUpdatesEnabled_ = NO; |
505 [fullscreenController_ cancelAnimationAndTimers]; | 507 [fullscreenController_ cancelAnimationAndTimers]; |
506 } | 508 } |
507 | 509 |
508 @end // @implementation BrowserWindowController(Private) | 510 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |