| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 initial_show_state_(ui::SHOW_STATE_DEFAULT), |
| 89 attention_request_id_(0) { | 89 attention_request_id_(0) { |
| 90 | 90 |
| 91 pref_change_registrar_.Init(browser_->profile()->GetPrefs()); | 91 pref_change_registrar_.Init(browser_->profile()->GetPrefs()); |
| 92 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); | 92 pref_change_registrar_.Add( |
| 93 prefs::kShowBookmarkBar, |
| 94 base::Bind(&BrowserWindowCocoa::OnShowBookmarkBarChanged, |
| 95 base::Unretained(this))); |
| 93 gfx::Rect bounds; | 96 gfx::Rect bounds; |
| 94 chrome::GetSavedWindowBoundsAndShowState(browser_, | 97 chrome::GetSavedWindowBoundsAndShowState(browser_, |
| 95 &bounds, | 98 &bounds, |
| 96 &initial_show_state_); | 99 &initial_show_state_); |
| 97 } | 100 } |
| 98 | 101 |
| 99 BrowserWindowCocoa::~BrowserWindowCocoa() { | 102 BrowserWindowCocoa::~BrowserWindowCocoa() { |
| 100 } | 103 } |
| 101 | 104 |
| 102 void BrowserWindowCocoa::Show() { | 105 void BrowserWindowCocoa::Show() { |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // BrowserWindow object. | 610 // BrowserWindow object. |
| 608 FindBarBridge* bridge = new FindBarBridge(); | 611 FindBarBridge* bridge = new FindBarBridge(); |
| 609 AddFindBar(bridge->find_bar_cocoa_controller()); | 612 AddFindBar(bridge->find_bar_cocoa_controller()); |
| 610 return bridge; | 613 return bridge; |
| 611 } | 614 } |
| 612 | 615 |
| 613 bool BrowserWindowCocoa::GetConstrainedWindowTopY(int* top_y) { | 616 bool BrowserWindowCocoa::GetConstrainedWindowTopY(int* top_y) { |
| 614 return false; | 617 return false; |
| 615 } | 618 } |
| 616 | 619 |
| 617 void BrowserWindowCocoa::OnPreferenceChanged(PrefServiceBase* service, | 620 void BrowserWindowCocoa::OnShowBookmarkBarChanged() { |
| 618 const std::string& pref_name) { | |
| 619 DCHECK(pref_name == prefs::kShowBookmarkBar); | |
| 620 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; | 621 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; |
| 621 } | 622 } |
| 622 | 623 |
| 623 extensions::ActiveTabPermissionGranter* | 624 extensions::ActiveTabPermissionGranter* |
| 624 BrowserWindowCocoa::GetActiveTabPermissionGranter() { | 625 BrowserWindowCocoa::GetActiveTabPermissionGranter() { |
| 625 TabContents* tab_contents = | 626 TabContents* tab_contents = |
| 626 browser_->tab_strip_model()->GetActiveTabContents(); | 627 browser_->tab_strip_model()->GetActiveTabContents(); |
| 627 if (!tab_contents) | 628 if (!tab_contents) |
| 628 return NULL; | 629 return NULL; |
| 629 extensions::TabHelper* tab_helper = | 630 extensions::TabHelper* tab_helper = |
| (...skipping 27 matching lines...) Expand all Loading... |
| 657 AvatarMenuBubbleController* menu = | 658 AvatarMenuBubbleController* menu = |
| 658 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 659 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
| 659 anchoredAt:point]; | 660 anchoredAt:point]; |
| 660 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 661 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
| 661 [menu showWindow:nil]; | 662 [menu showWindow:nil]; |
| 662 } | 663 } |
| 663 | 664 |
| 664 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 665 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
| 665 [[controller_ avatarButtonController] showAvatarBubble]; | 666 [[controller_ avatarButtonController] showAvatarBubble]; |
| 666 } | 667 } |
| OLD | NEW |