| 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 "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // We will be notified when that happens with the AddObserver() call. | 25 // We will be notified when that happens with the AddObserver() call. |
| 26 if (model->loaded()) | 26 if (model->loaded()) |
| 27 Loaded(model, false); | 27 Loaded(model, false); |
| 28 | 28 |
| 29 profile_pref_registrar_.Init(profile->GetPrefs()); | 29 profile_pref_registrar_.Init(profile->GetPrefs()); |
| 30 profile_pref_registrar_.Add( | 30 profile_pref_registrar_.Add( |
| 31 prefs::kShowAppsShortcutInBookmarkBar, | 31 prefs::kShowAppsShortcutInBookmarkBar, |
| 32 base::Bind(&BookmarkBarBridge::OnAppsPageShortcutVisibilityPrefChanged, | 32 base::Bind(&BookmarkBarBridge::OnAppsPageShortcutVisibilityPrefChanged, |
| 33 base::Unretained(this))); | 33 base::Unretained(this))); |
| 34 | 34 |
| 35 // The first check for the app launcher is asynchronous, run it now. | 35 [controller_ updateAppsPageShortcutButtonVisibility]; |
| 36 apps::GetIsAppLauncherEnabled( | |
| 37 base::Bind(&BookmarkBarBridge::OnAppLauncherEnabledCompleted, | |
| 38 base::Unretained(this))); | |
| 39 } | 36 } |
| 40 | 37 |
| 41 BookmarkBarBridge::~BookmarkBarBridge() { | 38 BookmarkBarBridge::~BookmarkBarBridge() { |
| 42 model_->RemoveObserver(this); | 39 model_->RemoveObserver(this); |
| 43 } | 40 } |
| 44 | 41 |
| 45 void BookmarkBarBridge::Loaded(BookmarkModel* model, bool ids_reassigned) { | 42 void BookmarkBarBridge::Loaded(BookmarkModel* model, bool ids_reassigned) { |
| 46 [controller_ loaded:model]; | 43 [controller_ loaded:model]; |
| 47 } | 44 } |
| 48 | 45 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 97 } |
| 101 | 98 |
| 102 void BookmarkBarBridge::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { | 99 void BookmarkBarBridge::ExtensiveBookmarkChangesEnded(BookmarkModel* model) { |
| 103 batch_mode_ = false; | 100 batch_mode_ = false; |
| 104 [controller_ loaded:model]; | 101 [controller_ loaded:model]; |
| 105 } | 102 } |
| 106 | 103 |
| 107 void BookmarkBarBridge::OnAppsPageShortcutVisibilityPrefChanged() { | 104 void BookmarkBarBridge::OnAppsPageShortcutVisibilityPrefChanged() { |
| 108 [controller_ updateAppsPageShortcutButtonVisibility]; | 105 [controller_ updateAppsPageShortcutButtonVisibility]; |
| 109 } | 106 } |
| 110 | |
| 111 void BookmarkBarBridge::OnAppLauncherEnabledCompleted( | |
| 112 bool app_launcher_enabled) { | |
| 113 [controller_ updateAppsPageShortcutButtonVisibility]; | |
| 114 } | |
| OLD | NEW |