Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 11308295: Revert 170483 - Remove PrefObserver usages, batch 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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( 92 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
93 prefs::kShowBookmarkBar,
94 base::Bind(&BrowserWindowCocoa::OnShowBookmarkBarChanged,
95 base::Unretained(this)));
96 gfx::Rect bounds; 93 gfx::Rect bounds;
97 chrome::GetSavedWindowBoundsAndShowState(browser_, 94 chrome::GetSavedWindowBoundsAndShowState(browser_,
98 &bounds, 95 &bounds,
99 &initial_show_state_); 96 &initial_show_state_);
100 } 97 }
101 98
102 BrowserWindowCocoa::~BrowserWindowCocoa() { 99 BrowserWindowCocoa::~BrowserWindowCocoa() {
103 } 100 }
104 101
105 void BrowserWindowCocoa::Show() { 102 void BrowserWindowCocoa::Show() {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 // BrowserWindow object. 607 // BrowserWindow object.
611 FindBarBridge* bridge = new FindBarBridge(); 608 FindBarBridge* bridge = new FindBarBridge();
612 AddFindBar(bridge->find_bar_cocoa_controller()); 609 AddFindBar(bridge->find_bar_cocoa_controller());
613 return bridge; 610 return bridge;
614 } 611 }
615 612
616 bool BrowserWindowCocoa::GetConstrainedWindowTopY(int* top_y) { 613 bool BrowserWindowCocoa::GetConstrainedWindowTopY(int* top_y) {
617 return false; 614 return false;
618 } 615 }
619 616
620 void BrowserWindowCocoa::OnShowBookmarkBarChanged() { 617 void BrowserWindowCocoa::OnPreferenceChanged(PrefServiceBase* service,
618 const std::string& pref_name) {
619 DCHECK(pref_name == prefs::kShowBookmarkBar);
621 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; 620 [controller_ updateBookmarkBarVisibilityWithAnimation:YES];
622 } 621 }
623 622
624 extensions::ActiveTabPermissionGranter* 623 extensions::ActiveTabPermissionGranter*
625 BrowserWindowCocoa::GetActiveTabPermissionGranter() { 624 BrowserWindowCocoa::GetActiveTabPermissionGranter() {
626 TabContents* tab_contents = 625 TabContents* tab_contents =
627 browser_->tab_strip_model()->GetActiveTabContents(); 626 browser_->tab_strip_model()->GetActiveTabContents();
628 if (!tab_contents) 627 if (!tab_contents)
629 return NULL; 628 return NULL;
630 extensions::TabHelper* tab_helper = 629 extensions::TabHelper* tab_helper =
(...skipping 27 matching lines...) Expand all
658 AvatarMenuBubbleController* menu = 657 AvatarMenuBubbleController* menu =
659 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ 658 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_
660 anchoredAt:point]; 659 anchoredAt:point];
661 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; 660 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
662 [menu showWindow:nil]; 661 [menu showWindow:nil];
663 } 662 }
664 663
665 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { 664 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() {
666 [[controller_ avatarButtonController] showAvatarBubble]; 665 [[controller_ avatarButtonController] showAvatarBubble];
667 } 666 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698