OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; | 78 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; |
79 @end | 79 @end |
80 | 80 |
81 #endif // MAC_OS_X_VERSION_10_7 | 81 #endif // MAC_OS_X_VERSION_10_7 |
82 | 82 |
83 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, | 83 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, |
84 BrowserWindowController* controller) | 84 BrowserWindowController* controller) |
85 : browser_(browser), | 85 : browser_(browser), |
86 controller_(controller), | 86 controller_(controller), |
87 confirm_close_factory_(browser), | 87 confirm_close_factory_(browser), |
| 88 initial_show_state_(ui::SHOW_STATE_DEFAULT), |
88 attention_request_id_(0) { | 89 attention_request_id_(0) { |
89 | 90 |
90 pref_change_registrar_.Init(browser_->profile()->GetPrefs()); | 91 pref_change_registrar_.Init(browser_->profile()->GetPrefs()); |
91 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); | 92 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); |
92 | 93 gfx::Rect bounds; |
93 initial_show_state_ = chrome::GetSavedWindowShowState(browser_); | 94 chrome::GetSavedWindowBoundsAndShowState(browser_, |
| 95 &bounds, |
| 96 &initial_show_state_); |
94 } | 97 } |
95 | 98 |
96 BrowserWindowCocoa::~BrowserWindowCocoa() { | 99 BrowserWindowCocoa::~BrowserWindowCocoa() { |
97 } | 100 } |
98 | 101 |
99 void BrowserWindowCocoa::Show() { | 102 void BrowserWindowCocoa::Show() { |
100 // The Browser associated with this browser window must become the active | 103 // The Browser associated with this browser window must become the active |
101 // browser at the time |Show()| is called. This is the natural behaviour under | 104 // browser at the time |Show()| is called. This is the natural behaviour under |
102 // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:| | 105 // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:| |
103 // until we return to the runloop. Therefore any calls to | 106 // until we return to the runloop. Therefore any calls to |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 AvatarMenuBubbleController* menu = | 655 AvatarMenuBubbleController* menu = |
653 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 656 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
654 anchoredAt:point]; | 657 anchoredAt:point]; |
655 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 658 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
656 [menu showWindow:nil]; | 659 [menu showWindow:nil]; |
657 } | 660 } |
658 | 661 |
659 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 662 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
660 [[controller_ avatarButtonController] showAvatarBubble]; | 663 [[controller_ avatarButtonController] showAvatarBubble]; |
661 } | 664 } |
OLD | NEW |