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/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 button->SetText(node->GetTitle()); | 1489 button->SetText(node->GetTitle()); |
1490 button->SetAccessibleName(node->GetTitle()); | 1490 button->SetAccessibleName(node->GetTitle()); |
1491 button->set_id(VIEW_ID_BOOKMARK_BAR_ELEMENT); | 1491 button->set_id(VIEW_ID_BOOKMARK_BAR_ELEMENT); |
1492 // We don't always have a theme provider (ui tests, for example). | 1492 // We don't always have a theme provider (ui tests, for example). |
1493 if (GetThemeProvider()) { | 1493 if (GetThemeProvider()) { |
1494 button->SetTextColor( | 1494 button->SetTextColor( |
1495 views::Button::STATE_NORMAL, | 1495 views::Button::STATE_NORMAL, |
1496 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); | 1496 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); |
1497 } | 1497 } |
1498 | 1498 |
1499 button->set_min_size(gfx::Size()); | 1499 button->SetMinSize(gfx::Size()); |
1500 button->set_context_menu_controller(this); | 1500 button->set_context_menu_controller(this); |
1501 button->set_drag_controller(this); | 1501 button->set_drag_controller(this); |
1502 if (node->is_url()) { | 1502 if (node->is_url()) { |
1503 const gfx::Image& favicon = model_->GetFavicon(node); | 1503 const gfx::Image& favicon = model_->GetFavicon(node); |
1504 if (!favicon.IsEmpty()) | 1504 if (!favicon.IsEmpty()) |
1505 button->SetImage(views::Button::STATE_NORMAL, *favicon.ToImageSkia()); | 1505 button->SetImage(views::Button::STATE_NORMAL, *favicon.ToImageSkia()); |
1506 else | 1506 else |
1507 button->SetImage(views::Button::STATE_NORMAL, GetDefaultFavicon()); | 1507 button->SetImage(views::Button::STATE_NORMAL, GetDefaultFavicon()); |
1508 } | 1508 } |
1509 button->set_max_size(gfx::Size(kMaxButtonWidth, 0)); | 1509 button->SetMaxSize(gfx::Size(kMaxButtonWidth, 0)); |
1510 } | 1510 } |
1511 | 1511 |
1512 void BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model, | 1512 void BookmarkBarView::BookmarkNodeAddedImpl(BookmarkModel* model, |
1513 const BookmarkNode* parent, | 1513 const BookmarkNode* parent, |
1514 int index) { | 1514 int index) { |
1515 UpdateButtonsVisibility(); | 1515 UpdateButtonsVisibility(); |
1516 if (parent != model->bookmark_bar_node()) { | 1516 if (parent != model->bookmark_bar_node()) { |
1517 // We only care about nodes on the bookmark bar. | 1517 // We only care about nodes on the bookmark bar. |
1518 return; | 1518 return; |
1519 } | 1519 } |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 DCHECK(apps_page_shortcut_); | 1952 DCHECK(apps_page_shortcut_); |
1953 // Only perform layout if required. | 1953 // Only perform layout if required. |
1954 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1954 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
1955 browser_->profile(), browser_->host_desktop_type()); | 1955 browser_->profile(), browser_->host_desktop_type()); |
1956 if (apps_page_shortcut_->visible() == visible) | 1956 if (apps_page_shortcut_->visible() == visible) |
1957 return; | 1957 return; |
1958 apps_page_shortcut_->SetVisible(visible); | 1958 apps_page_shortcut_->SetVisible(visible); |
1959 UpdateBookmarksSeparatorVisibility(); | 1959 UpdateBookmarksSeparatorVisibility(); |
1960 Layout(); | 1960 Layout(); |
1961 } | 1961 } |
OLD | NEW |