Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
index 09663d82ebafee9cbf9c216fd11f2dfde8a1d0eb..b7f181832b4df3637cf8e93f317cd62d8ff589df 100644 |
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
@@ -21,7 +21,7 @@ |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/browser/profiles/profile.h" |
-#include "chrome/browser/sync/sync_ui_util.h" |
+#include "chrome/browser/sync/profile_sync_service.h" |
#include "chrome/browser/themes/theme_service.h" |
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
#include "chrome/browser/ui/browser.h" |
@@ -118,9 +118,6 @@ static const int kInstructionsPadding = 6; |
// Tag for the 'Other bookmarks' button. |
static const int kOtherFolderButtonTag = 1; |
-// Tag for the sync error button. |
-static const int kSyncErrorButtonTag = 2; |
- |
namespace { |
// BookmarkButton ------------------------------------------------------------- |
@@ -371,8 +368,6 @@ BookmarkBarView::BookmarkBarView(Browser* browser) |
bookmark_drop_menu_(NULL), |
other_bookmarked_button_(NULL), |
ALLOW_THIS_IN_INITIALIZER_LIST(show_folder_method_factory_(this)), |
- sync_error_button_(NULL), |
- sync_service_(browser->profile()->GetProfileSyncService()), |
overflow_button_(NULL), |
instructions_(NULL), |
bookmarks_separator_view_(NULL), |
@@ -381,9 +376,6 @@ BookmarkBarView::BookmarkBarView(Browser* browser) |
throbbing_view_(NULL), |
bookmark_bar_state_(BookmarkBar::SHOW), |
animating_detached_(false) { |
- if (sync_service_) |
- sync_service_->AddObserver(this); |
- |
set_id(VIEW_ID_BOOKMARK_BAR); |
Init(); |
@@ -404,9 +396,6 @@ BookmarkBarView::~BookmarkBarView() { |
context_menu_->SetPageNavigator(NULL); |
StopShowFolderDropMenuTimer(); |
- |
- if (sync_service_) |
- sync_service_->RemoveObserver(this); |
} |
void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { |
@@ -594,20 +583,15 @@ gfx::Size BookmarkBarView::GetMinimumSize() { |
width += 2 * static_cast<int>(kNewtabHorizontalPadding * current_state); |
} |
- int sync_error_total_width = 0; |
- gfx::Size sync_error_button_pref = sync_error_button_->GetPreferredSize(); |
- if (sync_ui_util::ShouldShowSyncErrorButton(sync_service_)) |
- sync_error_total_width += kButtonPadding + sync_error_button_pref.width(); |
- |
gfx::Size other_bookmarked_pref = |
other_bookmarked_button_->GetPreferredSize(); |
gfx::Size overflow_pref = overflow_button_->GetPreferredSize(); |
gfx::Size bookmarks_separator_pref = |
bookmarks_separator_view_->GetPreferredSize(); |
- width += (other_bookmarked_pref.width() + kButtonPadding + |
+ width += other_bookmarked_pref.width() + kButtonPadding + |
overflow_pref.width() + kButtonPadding + |
- bookmarks_separator_pref.width() + sync_error_total_width); |
+ bookmarks_separator_pref.width(); |
return gfx::Size(width, browser_defaults::kBookmarkBarHeight); |
} |
@@ -827,20 +811,6 @@ void BookmarkBarView::GetAccessibleState(ui::AccessibleViewState* state) { |
state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS); |
} |
-void BookmarkBarView::OnStateChanged() { |
- // When the sync state changes, it is sufficient to invoke View::Layout since |
- // during layout we query the profile sync service and determine whether the |
- // new state requires showing the sync error button so that the user can |
- // re-enter her password. If extension shelf appears along with the bookmark |
- // shelf, it too needs to be layed out. Since both have the same parent, it is |
- // enough to let the parent layout both of these children. |
- // TODO(sky): This should not require Layout() and SchedulePaint(). Needs |
- // some cleanup. |
- PreferredSizeChanged(); |
- Layout(); |
- SchedulePaint(); |
-} |
- |
void BookmarkBarView::AnimationProgressed(const ui::Animation* animation) { |
if (browser_) |
browser_->BookmarkBarSizeChanged(true); |
@@ -1041,14 +1011,6 @@ void BookmarkBarView::RunMenu(views::View* view, const gfx::Point& pt) { |
void BookmarkBarView::ButtonPressed(views::Button* sender, |
const views::Event& event) { |
- // Show the login wizard if the user clicked the re-login button. |
- if (sender->tag() == kSyncErrorButtonTag) { |
- DCHECK(sender == sync_error_button_); |
- DCHECK(sync_service_ && !sync_service_->IsManaged()); |
- sync_service_->ShowErrorUI(); |
- return; |
- } |
- |
const BookmarkNode* node; |
if (sender->tag() == kOtherFolderButtonTag) { |
node = model_->other_node(); |
@@ -1153,9 +1115,6 @@ void BookmarkBarView::Init() { |
// Child views are traversed in the order they are added. Make sure the order |
// they are added matches the visual order. |
- sync_error_button_ = CreateSyncErrorButton(); |
- AddChildView(sync_error_button_); |
- |
overflow_button_ = CreateOverflowButton(); |
AddChildView(overflow_button_); |
@@ -1190,10 +1149,9 @@ void BookmarkBarView::Init() { |
} |
int BookmarkBarView::GetBookmarkButtonCount() { |
- // We contain five non-bookmark button views: other bookmarks, bookmarks |
- // separator, chevrons (for overflow), the instruction label and the sync |
- // error button. |
- return child_count() - 5; |
+ // We contain four non-bookmark button views: other bookmarks, bookmarks |
+ // separator, chevrons (for overflow), and the instruction label. |
+ return child_count() - 4; |
} |
views::TextButton* BookmarkBarView::GetBookmarkButton(int index) { |
@@ -1247,22 +1205,6 @@ MenuButton* BookmarkBarView::CreateOverflowButton() { |
return button; |
} |
-views::TextButton* BookmarkBarView::CreateSyncErrorButton() { |
- views::TextButton* sync_error_button = new views::TextButton( |
- this, l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR)); |
- sync_error_button->set_tag(kSyncErrorButtonTag); |
- |
- // The tooltip is the only way we have to display text explaining the error |
- // to the user. |
- sync_error_button->SetTooltipText( |
- l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
- sync_error_button->SetAccessibleName( |
- l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
- sync_error_button->SetIcon( |
- *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
- return sync_error_button; |
-} |
- |
views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { |
if (node->is_url()) { |
BookmarkButton* button = new BookmarkButton( |
@@ -1311,9 +1253,10 @@ void BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model, |
} |
DCHECK(index >= 0 && index <= GetBookmarkButtonCount()); |
const BookmarkNode* node = parent->GetChild(index); |
- if (!throbbing_view_ && sync_service_ && sync_service_->SetupInProgress()) { |
+ ProfileSyncService* sync_service = |
+ browser_->profile()->GetProfileSyncService(); |
+ if (!throbbing_view_ && sync_service && sync_service->SetupInProgress()) |
StartThrobbing(node, true); |
- } |
AddChildViewAt(CreateBookmarkButton(node), index); |
UpdateColors(); |
Layout(); |
@@ -1630,13 +1573,8 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { |
gfx::Size bookmarks_separator_pref = |
bookmarks_separator_view_->GetPreferredSize(); |
- int sync_error_total_width = 0; |
- gfx::Size sync_error_button_pref = sync_error_button_->GetPreferredSize(); |
- if (sync_ui_util::ShouldShowSyncErrorButton(sync_service_)) { |
- sync_error_total_width += kButtonPadding + sync_error_button_pref.width(); |
- } |
int max_x = width - overflow_pref.width() - kButtonPadding - |
- bookmarks_separator_pref.width() - sync_error_total_width; |
+ bookmarks_separator_pref.width(); |
if (other_bookmarked_button_->IsVisible()) |
max_x -= other_bookmarked_pref.width() + kButtonPadding; |
@@ -1708,21 +1646,6 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { |
x += other_bookmarked_pref.width() + kButtonPadding; |
} |
- // Set the real bounds of the sync error button only if it needs to appear on |
- // the bookmarks bar. |
- if (sync_ui_util::ShouldShowSyncErrorButton(sync_service_)) { |
- x += kButtonPadding; |
- if (!compute_bounds_only) { |
- sync_error_button_->SetBounds( |
- x, y, sync_error_button_pref.width(), height); |
- sync_error_button_->SetVisible(true); |
- } |
- x += sync_error_button_pref.width(); |
- } else if (!compute_bounds_only) { |
- sync_error_button_->SetBounds(x, y, 0, height); |
- sync_error_button_->SetVisible(false); |
- } |
- |
// Set the preferred size computed so far. |
if (compute_bounds_only) { |
x += kRightMargin; |