| 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> |
| 11 | 11 |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/os_exchange_data.h" | 13 #include "app/os_exchange_data.h" |
| 14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
| 15 #include "app/text_elider.h" | 15 #include "app/text_elider.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_model.h" | 19 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_utils.h" | 20 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 21 #include "chrome/browser/browser.h" | 21 #include "chrome/browser/browser.h" |
| 22 #include "chrome/browser/browser_shutdown.h" |
| 22 #include "chrome/browser/chrome_thread.h" | 23 #include "chrome/browser/chrome_thread.h" |
| 23 #include "chrome/browser/importer/importer_data_types.h" | 24 #include "chrome/browser/importer/importer_data_types.h" |
| 24 #include "chrome/browser/metrics/user_metrics.h" | 25 #include "chrome/browser/metrics/user_metrics.h" |
| 25 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 26 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
| 27 #include "chrome/browser/renderer_host/render_view_host.h" | 28 #include "chrome/browser/renderer_host/render_view_host.h" |
| 28 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 29 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 29 #include "chrome/browser/sync/sync_ui_util.h" | 30 #include "chrome/browser/sync/sync_ui_util.h" |
| 30 #include "chrome/browser/tab_contents/page_navigator.h" | 31 #include "chrome/browser/tab_contents/page_navigator.h" |
| 31 #include "chrome/browser/tab_contents/tab_contents.h" | 32 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 for (int i = 0, child_count = node->GetChildCount(); i < child_count; ++i) | 962 for (int i = 0, child_count = node->GetChildCount(); i < child_count; ++i) |
| 962 AddChildView(i, CreateBookmarkButton(node->GetChild(i))); | 963 AddChildView(i, CreateBookmarkButton(node->GetChild(i))); |
| 963 UpdateColors(); | 964 UpdateColors(); |
| 964 other_bookmarked_button_->SetEnabled(true); | 965 other_bookmarked_button_->SetEnabled(true); |
| 965 | 966 |
| 966 Layout(); | 967 Layout(); |
| 967 SchedulePaint(); | 968 SchedulePaint(); |
| 968 } | 969 } |
| 969 | 970 |
| 970 void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkModel* model) { | 971 void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkModel* model) { |
| 971 // The bookmark model should never be deleted before us. This code exists | 972 // In normal shutdown The bookmark model should never be deleted before us. |
| 973 // When X exits suddenly though, it can happen, This code exists |
| 972 // to check for regressions in shutdown code and not crash. | 974 // to check for regressions in shutdown code and not crash. |
| 973 NOTREACHED(); | 975 if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers()) |
| 976 NOTREACHED(); |
| 974 | 977 |
| 975 // Do minimal cleanup, presumably we'll be deleted shortly. | 978 // Do minimal cleanup, presumably we'll be deleted shortly. |
| 976 NotifyModelChanged(); | 979 NotifyModelChanged(); |
| 977 model_->RemoveObserver(this); | 980 model_->RemoveObserver(this); |
| 978 model_ = NULL; | 981 model_ = NULL; |
| 979 } | 982 } |
| 980 | 983 |
| 981 void BookmarkBarView::BookmarkNodeMoved(BookmarkModel* model, | 984 void BookmarkBarView::BookmarkNodeMoved(BookmarkModel* model, |
| 982 const BookmarkNode* old_parent, | 985 const BookmarkNode* old_parent, |
| 983 int old_index, | 986 int old_index, |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 // The tooltip is the only way we have to display text explaining the error | 1722 // The tooltip is the only way we have to display text explaining the error |
| 1720 // to the user. | 1723 // to the user. |
| 1721 sync_error_button->SetTooltipText( | 1724 sync_error_button->SetTooltipText( |
| 1722 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1725 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
| 1723 sync_error_button->SetAccessibleName( | 1726 sync_error_button->SetAccessibleName( |
| 1724 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1727 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
| 1725 sync_error_button->SetIcon( | 1728 sync_error_button->SetIcon( |
| 1726 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1729 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
| 1727 return sync_error_button; | 1730 return sync_error_button; |
| 1728 } | 1731 } |
| OLD | NEW |