OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #import "base/memory/scoped_nsobject.h" | 8 #import "base/memory/scoped_nsobject.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
13 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 14 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
14 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 15 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
15 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 16 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
16 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 17 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
17 #import "chrome/browser/ui/cocoa/fullscreen_controller.h" | 18 #import "chrome/browser/ui/cocoa/fullscreen_controller.h" |
18 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 19 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
19 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 20 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
20 #import "chrome/browser/ui/cocoa/tabs/side_tab_strip_controller.h" | 21 #import "chrome/browser/ui/cocoa/tabs/side_tab_strip_controller.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); | 110 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); |
110 | 111 |
111 // We also need to save the current work area, in flipped coordinates. | 112 // We also need to save the current work area, in flipped coordinates. |
112 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); | 113 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); |
113 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); | 114 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); |
114 | 115 |
115 // Browser::SaveWindowPlacement is used for session restore. | 116 // Browser::SaveWindowPlacement is used for session restore. |
116 if (browser_->ShouldSaveWindowPlacement()) | 117 if (browser_->ShouldSaveWindowPlacement()) |
117 browser_->SaveWindowPlacement(bounds, /*maximized=*/ false); | 118 browser_->SaveWindowPlacement(bounds, /*maximized=*/ false); |
118 | 119 |
119 DictionaryValue* windowPreferences = prefs->GetMutableDictionary( | 120 DictionaryPrefUpdate update(prefs, browser_->GetWindowPlacementKey().c_str()); |
120 browser_->GetWindowPlacementKey().c_str()); | 121 DictionaryValue* windowPreferences = update.Get(); |
121 windowPreferences->SetInteger("left", bounds.x()); | 122 windowPreferences->SetInteger("left", bounds.x()); |
122 windowPreferences->SetInteger("top", bounds.y()); | 123 windowPreferences->SetInteger("top", bounds.y()); |
123 windowPreferences->SetInteger("right", bounds.right()); | 124 windowPreferences->SetInteger("right", bounds.right()); |
124 windowPreferences->SetInteger("bottom", bounds.bottom()); | 125 windowPreferences->SetInteger("bottom", bounds.bottom()); |
125 windowPreferences->SetBoolean("maximized", false); | 126 windowPreferences->SetBoolean("maximized", false); |
126 windowPreferences->SetBoolean("always_on_top", false); | 127 windowPreferences->SetBoolean("always_on_top", false); |
127 windowPreferences->SetInteger("work_area_left", workArea.x()); | 128 windowPreferences->SetInteger("work_area_left", workArea.x()); |
128 windowPreferences->SetInteger("work_area_top", workArea.y()); | 129 windowPreferences->SetInteger("work_area_top", workArea.y()); |
129 windowPreferences->SetInteger("work_area_right", workArea.right()); | 130 windowPreferences->SetInteger("work_area_right", workArea.right()); |
130 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); | 131 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 - (void)disableBarVisibilityUpdates { | 531 - (void)disableBarVisibilityUpdates { |
531 // Early escape if there's nothing to do. | 532 // Early escape if there's nothing to do. |
532 if (!barVisibilityUpdatesEnabled_) | 533 if (!barVisibilityUpdatesEnabled_) |
533 return; | 534 return; |
534 | 535 |
535 barVisibilityUpdatesEnabled_ = NO; | 536 barVisibilityUpdatesEnabled_ = NO; |
536 [fullscreenController_ cancelAnimationAndTimers]; | 537 [fullscreenController_ cancelAnimationAndTimers]; |
537 } | 538 } |
538 | 539 |
539 @end // @implementation BrowserWindowController(Private) | 540 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |