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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 node = model_->other_node(); | 1182 node = model_->other_node(); |
1183 } else if (view == overflow_button_) { | 1183 } else if (view == overflow_button_) { |
1184 node = model_->GetBookmarkBarNode(); | 1184 node = model_->GetBookmarkBarNode(); |
1185 start_index = GetFirstHiddenNodeIndex(); | 1185 start_index = GetFirstHiddenNodeIndex(); |
1186 } else { | 1186 } else { |
1187 int button_index = GetChildIndex(view); | 1187 int button_index = GetChildIndex(view); |
1188 DCHECK_NE(-1, button_index); | 1188 DCHECK_NE(-1, button_index); |
1189 node = model_->GetBookmarkBarNode()->GetChild(button_index); | 1189 node = model_->GetBookmarkBarNode()->GetChild(button_index); |
1190 } | 1190 } |
1191 | 1191 |
1192 bookmark_menu_ = new BookmarkMenuController( | 1192 bookmark_menu_ = new BookmarkMenuController(browser_, profile_, |
1193 browser_, profile_, page_navigator_, GetWindow()->GetNativeWindow(), | 1193 page_navigator_, GetWindow()->GetNativeWindow(), node, start_index); |
1194 node, start_index, false); | |
1195 bookmark_menu_->set_observer(this); | 1194 bookmark_menu_->set_observer(this); |
1196 bookmark_menu_->RunMenuAt(this, false); | 1195 bookmark_menu_->RunMenuAt(this, false); |
1197 } | 1196 } |
1198 | 1197 |
1199 void BookmarkBarView::ButtonPressed(views::Button* sender, | 1198 void BookmarkBarView::ButtonPressed(views::Button* sender, |
1200 const views::Event& event) { | 1199 const views::Event& event) { |
1201 // Show the login wizard if the user clicked the re-login button. | 1200 // Show the login wizard if the user clicked the re-login button. |
1202 if (sender->tag() == kSyncErrorButtonTag) { | 1201 if (sender->tag() == kSyncErrorButtonTag) { |
1203 DCHECK(sender == sync_error_button_); | 1202 DCHECK(sender == sync_error_button_); |
1204 DCHECK(sync_service_); | 1203 DCHECK(sync_service_); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 | 1367 |
1369 views::MenuButton* menu_button = GetMenuButtonForNode(node); | 1368 views::MenuButton* menu_button = GetMenuButtonForNode(node); |
1370 if (!menu_button) | 1369 if (!menu_button) |
1371 return; | 1370 return; |
1372 | 1371 |
1373 int start_index = 0; | 1372 int start_index = 0; |
1374 if (node == model_->GetBookmarkBarNode()) | 1373 if (node == model_->GetBookmarkBarNode()) |
1375 start_index = GetFirstHiddenNodeIndex(); | 1374 start_index = GetFirstHiddenNodeIndex(); |
1376 | 1375 |
1377 drop_info_->is_menu_showing = true; | 1376 drop_info_->is_menu_showing = true; |
1378 bookmark_drop_menu_ = new BookmarkMenuController( | 1377 bookmark_drop_menu_ = new BookmarkMenuController(browser_, profile_, |
1379 browser_, profile_, page_navigator_, GetWindow()->GetNativeWindow(), | 1378 page_navigator_, GetWindow()->GetNativeWindow(), node, start_index); |
1380 node, start_index, false); | |
1381 bookmark_drop_menu_->set_observer(this); | 1379 bookmark_drop_menu_->set_observer(this); |
1382 bookmark_drop_menu_->RunMenuAt(this, true); | 1380 bookmark_drop_menu_->RunMenuAt(this, true); |
1383 } | 1381 } |
1384 | 1382 |
1385 void BookmarkBarView::StopShowFolderDropMenuTimer() { | 1383 void BookmarkBarView::StopShowFolderDropMenuTimer() { |
1386 if (show_folder_drop_menu_task_) | 1384 if (show_folder_drop_menu_task_) |
1387 show_folder_drop_menu_task_->Cancel(); | 1385 show_folder_drop_menu_task_->Cancel(); |
1388 } | 1386 } |
1389 | 1387 |
1390 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { | 1388 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 | 1741 |
1744 void BookmarkBarView::CheckIntegrity() { | 1742 void BookmarkBarView::CheckIntegrity() { |
1745 // We better be on the ui thread. | 1743 // We better be on the ui thread. |
1746 CHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 1744 CHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
1747 | 1745 |
1748 // And the number of views on the bookmark bar better match that of the model. | 1746 // And the number of views on the bookmark bar better match that of the model. |
1749 volatile int model_count = model_->GetBookmarkBarNode()->GetChildCount(); | 1747 volatile int model_count = model_->GetBookmarkBarNode()->GetChildCount(); |
1750 volatile int view_count = GetBookmarkButtonCount(); | 1748 volatile int view_count = GetBookmarkButtonCount(); |
1751 CHECK_EQ(model_count, view_count); | 1749 CHECK_EQ(model_count, view_count); |
1752 } | 1750 } |
OLD | NEW |