OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "chrome/browser/cocoa/bookmark_bar_state_controller.h" |
| 6 #import "chrome/browser/bookmarks/bookmark_utils.h" |
| 7 #import "chrome/browser/browser.h" |
| 8 |
| 9 |
| 10 @implementation BookmarkBarStateController |
| 11 |
| 12 - (id)initWithBrowser:(Browser *)browser { |
| 13 if ((self = [super init])) { |
| 14 browser_ = browser; |
| 15 // Initial visibility state comes from our preference. |
| 16 if (browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar)) { |
| 17 visible_ = YES; |
| 18 } |
| 19 } |
| 20 return self; |
| 21 } |
| 22 |
| 23 - (BOOL)visible { |
| 24 return visible_; |
| 25 } |
| 26 |
| 27 // Whack and save a preference change. On Windows this call |
| 28 // is made from BookmarkBarView. |
| 29 - (void)togglePreference { |
| 30 bookmark_utils::ToggleWhenVisible(browser_->profile()); |
| 31 } |
| 32 |
| 33 - (void)toggleBookmarkBar { |
| 34 visible_ = visible_ ? NO : YES; |
| 35 [self togglePreference]; |
| 36 } |
| 37 |
| 38 @end // BookmarkBarStateController |
OLD | NEW |