| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 #import "chrome/browser/cocoa/bookmark_bar_state_controller.h" | 5 #import "chrome/browser/cocoa/bookmark_bar_state_controller.h" |
| 6 #import "chrome/browser/bookmarks/bookmark_utils.h" | 6 #import "chrome/browser/bookmarks/bookmark_utils.h" |
| 7 #import "chrome/browser/browser.h" | 7 #import "chrome/browser/browser.h" |
| 8 #import "chrome/common/pref_names.h" |
| 9 #import "chrome/common/pref_service.h" |
| 8 | 10 |
| 9 | 11 |
| 10 @implementation BookmarkBarStateController | 12 @implementation BookmarkBarStateController |
| 11 | 13 |
| 12 - (id)initWithBrowser:(Browser *)browser { | 14 - (id)initWithBrowser:(Browser *)browser { |
| 13 if ((self = [super init])) { | 15 if ((self = [super init])) { |
| 14 browser_ = browser; | 16 browser_ = browser; |
| 15 // Initial visibility state comes from our preference. | 17 // Initial visibility state comes from our preference. |
| 16 if (browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar)) { | 18 if (browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar)) { |
| 17 visible_ = YES; | 19 visible_ = YES; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 - (void)togglePreference { | 31 - (void)togglePreference { |
| 30 bookmark_utils::ToggleWhenVisible(browser_->profile()); | 32 bookmark_utils::ToggleWhenVisible(browser_->profile()); |
| 31 } | 33 } |
| 32 | 34 |
| 33 - (void)toggleBookmarkBar { | 35 - (void)toggleBookmarkBar { |
| 34 visible_ = visible_ ? NO : YES; | 36 visible_ = visible_ ? NO : YES; |
| 35 [self togglePreference]; | 37 [self togglePreference]; |
| 36 } | 38 } |
| 37 | 39 |
| 38 @end // BookmarkBarStateController | 40 @end // BookmarkBarStateController |
| OLD | NEW |