Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/bookmarks/bookmark_bar_bridge.h" | 5 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | |
| 8 #include "base/prefs/pref_service.h" | |
| 9 #include "base/prefs/pref_service.h" | |
|
Alexei Svitkine (slow)
2013/03/11 14:31:04
Remove double include.
beaudoin
2013/03/11 21:02:14
Done.
| |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 12 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 13 #include "chrome/common/pref_names.h" | |
| 9 | 14 |
| 10 BookmarkBarBridge::BookmarkBarBridge(BookmarkBarController* controller, | 15 |
| 16 BookmarkBarBridge::BookmarkBarBridge(Profile* profile, | |
| 17 BookmarkBarController* controller, | |
| 11 BookmarkModel* model) | 18 BookmarkModel* model) |
| 12 : controller_(controller), | 19 : controller_(controller), |
| 13 model_(model), | 20 model_(model), |
| 14 batch_mode_(false) { | 21 batch_mode_(false) { |
| 15 model_->AddObserver(this); | 22 model_->AddObserver(this); |
| 16 | 23 |
| 17 // Bookmark loading is async; it may may not have happened yet. | 24 // Bookmark loading is async; it may may not have happened yet. |
| 18 // We will be notified when that happens with the AddObserver() call. | 25 // We will be notified when that happens with the AddObserver() call. |
| 19 if (model->IsLoaded()) | 26 if (model->IsLoaded()) |
| 20 Loaded(model, false); | 27 Loaded(model, false); |
| 28 | |
| 29 profile_pref_registrar_.Init(profile->GetPrefs()); | |
| 30 profile_pref_registrar_.Add( | |
| 31 prefs::kShowAppsShortcutInBookmarkBar, | |
| 32 base::Bind(&BookmarkBarBridge::OnAppsPageShortcutVisibilityChanged, | |
| 33 base::Unretained(this))); | |
| 21 } | 34 } |
| 22 | 35 |
| 23 BookmarkBarBridge::~BookmarkBarBridge() { | 36 BookmarkBarBridge::~BookmarkBarBridge() { |
| 24 model_->RemoveObserver(this); | 37 model_->RemoveObserver(this); |
| 25 } | 38 } |
| 26 | 39 |
| 27 void BookmarkBarBridge::Loaded(BookmarkModel* model, bool ids_reassigned) { | 40 void BookmarkBarBridge::Loaded(BookmarkModel* model, bool ids_reassigned) { |
| 28 [controller_ loaded:model]; | 41 [controller_ loaded:model]; |
| 29 } | 42 } |
| 30 | 43 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 87 |
| 75 void BookmarkBarBridge::ExtensiveBookmarkChangesBeginning( | 88 void BookmarkBarBridge::ExtensiveBookmarkChangesBeginning( |
| 76 BookmarkModel* model) { | 89 BookmarkModel* model) { |
| 77 batch_mode_ = true; | 90 batch_mode_ = true; |
| 78 } | 91 } |
| 79 | 92 |
| 80 void BookmarkBarBridge::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { | 93 void BookmarkBarBridge::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { |
| 81 batch_mode_ = false; | 94 batch_mode_ = false; |
| 82 [controller_ loaded:model]; | 95 [controller_ loaded:model]; |
| 83 } | 96 } |
| 97 | |
| 98 void BookmarkBarBridge::OnAppsPageShortcutVisibilityChanged() { | |
| 99 [controller_ updateAppsPageShortcutButtonVisibility]; | |
| 100 } | |
| OLD | NEW |