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