| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/bookmark_bar_view.h" | 5 #include "chrome/browser/views/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_SHOWN, ns_source); | 440 registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_SHOWN, ns_source); |
| 441 registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_HIDDEN, ns_source); | 441 registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_HIDDEN, ns_source); |
| 442 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 442 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 443 NotificationService::AllSources()); | 443 NotificationService::AllSources()); |
| 444 | 444 |
| 445 // Remove any existing bookmark buttons. | 445 // Remove any existing bookmark buttons. |
| 446 while (GetBookmarkButtonCount()) | 446 while (GetBookmarkButtonCount()) |
| 447 delete GetChildViewAt(0); | 447 delete GetChildViewAt(0); |
| 448 | 448 |
| 449 model_ = profile_->GetBookmarkModel(); | 449 model_ = profile_->GetBookmarkModel(); |
| 450 model_->AddObserver(this); | 450 if (model_) { |
| 451 if (model_->IsLoaded()) | 451 model_->AddObserver(this); |
| 452 Loaded(model_); | 452 if (model_->IsLoaded()) |
| 453 // else case: we'll receive notification back from the BookmarkModel when done | 453 Loaded(model_); |
| 454 // loading, then we'll populate the bar. | 454 // else case: we'll receive notification back from the BookmarkModel when |
| 455 // done loading, then we'll populate the bar. |
| 456 } |
| 455 } | 457 } |
| 456 | 458 |
| 457 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { | 459 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { |
| 458 page_navigator_ = navigator; | 460 page_navigator_ = navigator; |
| 459 } | 461 } |
| 460 | 462 |
| 461 gfx::Size BookmarkBarView::GetPreferredSize() { | 463 gfx::Size BookmarkBarView::GetPreferredSize() { |
| 462 return LayoutItems(true); | 464 return LayoutItems(true); |
| 463 } | 465 } |
| 464 | 466 |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 // The tooltip is the only way we have to display text explaining the error | 1725 // The tooltip is the only way we have to display text explaining the error |
| 1724 // to the user. | 1726 // to the user. |
| 1725 sync_error_button->SetTooltipText( | 1727 sync_error_button->SetTooltipText( |
| 1726 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1728 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
| 1727 sync_error_button->SetAccessibleName( | 1729 sync_error_button->SetAccessibleName( |
| 1728 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1730 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
| 1729 sync_error_button->SetIcon( | 1731 sync_error_button->SetIcon( |
| 1730 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1732 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
| 1731 return sync_error_button; | 1733 return sync_error_button; |
| 1732 } | 1734 } |
| OLD | NEW |