blob: e4f9d11af5b9d3733d426dfe48913e3098d1722d (
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
39
40
41
|
// 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"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@implementation BookmarkBarStateController
- (id)initWithProfile:(Profile*)profile {
if ((self = [super init])) {
profile_ = profile;
// Initial visibility state comes from our preference.
if (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(profile_);
}
- (void)toggleBookmarkBar {
visible_ = visible_ ? NO : YES;
[self togglePreference];
}
@end // BookmarkBarStateController
|