| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 DCHECK(bookmark_button_index != -1 && | 1207 DCHECK(bookmark_button_index != -1 && |
| 1208 bookmark_button_index < GetBookmarkButtonCount()); | 1208 bookmark_button_index < GetBookmarkButtonCount()); |
| 1209 const BookmarkNode* node = | 1209 const BookmarkNode* node = |
| 1210 model_->GetBookmarkBarNode()->GetChild(bookmark_button_index); | 1210 model_->GetBookmarkBarNode()->GetChild(bookmark_button_index); |
| 1211 nodes.push_back(node); | 1211 nodes.push_back(node); |
| 1212 parent = node->GetParent(); | 1212 parent = node->GetParent(); |
| 1213 } else { | 1213 } else { |
| 1214 parent = model_->GetBookmarkBarNode(); | 1214 parent = model_->GetBookmarkBarNode(); |
| 1215 nodes.push_back(parent); | 1215 nodes.push_back(parent); |
| 1216 } | 1216 } |
| 1217 // Browser may be null during testing. |
| 1218 PageNavigator* navigator = |
| 1219 browser() ? browser()->GetSelectedTabContents() : NULL; |
| 1217 BookmarkContextMenu controller(GetWindow()->GetNativeWindow(), GetProfile(), | 1220 BookmarkContextMenu controller(GetWindow()->GetNativeWindow(), GetProfile(), |
| 1218 browser()->GetSelectedTabContents(), | 1221 navigator, parent, nodes, |
| 1219 parent, nodes, | |
| 1220 BookmarkContextMenuController::BOOKMARK_BAR); | 1222 BookmarkContextMenuController::BOOKMARK_BAR); |
| 1221 controller.RunMenuAt(gfx::Point(x, y)); | 1223 controller.RunMenuAt(gfx::Point(x, y)); |
| 1222 } | 1224 } |
| 1223 | 1225 |
| 1224 views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { | 1226 views::View* BookmarkBarView::CreateBookmarkButton(const BookmarkNode* node) { |
| 1225 if (node->is_url()) { | 1227 if (node->is_url()) { |
| 1226 BookmarkButton* button = new BookmarkButton(this, | 1228 BookmarkButton* button = new BookmarkButton(this, |
| 1227 node->GetURL(), | 1229 node->GetURL(), |
| 1228 node->GetTitle(), | 1230 node->GetTitle(), |
| 1229 GetProfile()); | 1231 GetProfile()); |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 // The tooltip is the only way we have to display text explaining the error | 1710 // The tooltip is the only way we have to display text explaining the error |
| 1709 // to the user. | 1711 // to the user. |
| 1710 sync_error_button->SetTooltipText( | 1712 sync_error_button->SetTooltipText( |
| 1711 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1713 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
| 1712 sync_error_button->SetAccessibleName( | 1714 sync_error_button->SetAccessibleName( |
| 1713 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1715 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
| 1714 sync_error_button->SetIcon( | 1716 sync_error_button->SetIcon( |
| 1715 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1717 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
| 1716 return sync_error_button; | 1718 return sync_error_button; |
| 1717 } | 1719 } |
| OLD | NEW |