| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/base_drag_source.h" | 9 #include "base/base_drag_source.h" |
| 10 #include "base/gfx/skia_utils.h" | 10 #include "base/gfx/skia_utils.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 446 } |
| 447 | 447 |
| 448 // Invoked when a menu item is selected. Uses the PageNavigator set on | 448 // Invoked when a menu item is selected. Uses the PageNavigator set on |
| 449 // the BookmarkBarView to open the URL. | 449 // the BookmarkBarView to open the URL. |
| 450 virtual void ExecuteCommand(int id, int mouse_event_flags) { | 450 virtual void ExecuteCommand(int id, int mouse_event_flags) { |
| 451 DCHECK(view_->GetPageNavigator()); | 451 DCHECK(view_->GetPageNavigator()); |
| 452 GURL url; | 452 GURL url; |
| 453 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); | 453 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); |
| 454 url = menu_id_to_node_map_[id]->GetURL(); | 454 url = menu_id_to_node_map_[id]->GetURL(); |
| 455 view_->GetPageNavigator()->OpenURL( | 455 view_->GetPageNavigator()->OpenURL( |
| 456 url, event_utils::DispositionFromEventFlags(mouse_event_flags), | 456 url, GURL(), event_utils::DispositionFromEventFlags(mouse_event_flags), |
| 457 PageTransition::AUTO_BOOKMARK); | 457 PageTransition::AUTO_BOOKMARK); |
| 458 } | 458 } |
| 459 | 459 |
| 460 virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data) { | 460 virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data) { |
| 461 // Only accept drops of 1 node, which is the case for all data dragged from | 461 // Only accept drops of 1 node, which is the case for all data dragged from |
| 462 // bookmark bar and menus. | 462 // bookmark bar and menus. |
| 463 if (!drop_data_.Read(data) || drop_data_.elements.size() != 1) | 463 if (!drop_data_.Read(data) || drop_data_.elements.size() != 1) |
| 464 return false; | 464 return false; |
| 465 | 465 |
| 466 if (drop_data_.has_single_url()) | 466 if (drop_data_.has_single_url()) |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 if (sender->GetTag() == kOtherFolderButtonTag) { | 1411 if (sender->GetTag() == kOtherFolderButtonTag) { |
| 1412 node = model_->other_node(); | 1412 node = model_->other_node(); |
| 1413 } else { | 1413 } else { |
| 1414 int index = GetChildIndex(sender); | 1414 int index = GetChildIndex(sender); |
| 1415 DCHECK(index != -1); | 1415 DCHECK(index != -1); |
| 1416 node = model_->GetBookmarkBarNode()->GetChild(index); | 1416 node = model_->GetBookmarkBarNode()->GetChild(index); |
| 1417 } | 1417 } |
| 1418 DCHECK(page_navigator_); | 1418 DCHECK(page_navigator_); |
| 1419 if (node->is_url()) { | 1419 if (node->is_url()) { |
| 1420 page_navigator_->OpenURL( | 1420 page_navigator_->OpenURL( |
| 1421 node->GetURL(), | 1421 node->GetURL(), GURL(), |
| 1422 event_utils::DispositionFromEventFlags(sender->mouse_event_flags()), | 1422 event_utils::DispositionFromEventFlags(sender->mouse_event_flags()), |
| 1423 PageTransition::AUTO_BOOKMARK); | 1423 PageTransition::AUTO_BOOKMARK); |
| 1424 } else { | 1424 } else { |
| 1425 BookmarkBarContextMenuController::OpenAll( | 1425 BookmarkBarContextMenuController::OpenAll( |
| 1426 GetContainer()->GetHWND(), GetPageNavigator(), node, | 1426 GetContainer()->GetHWND(), GetPageNavigator(), node, |
| 1427 event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); | 1427 event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); |
| 1428 } | 1428 } |
| 1429 UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", profile_); | 1429 UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", profile_); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 void BookmarkBarView::StopThrobbing(bool immediate) { | 1820 void BookmarkBarView::StopThrobbing(bool immediate) { |
| 1821 if (!throbbing_view_) | 1821 if (!throbbing_view_) |
| 1822 return; | 1822 return; |
| 1823 | 1823 |
| 1824 // If not immediate, cycle through 2 more complete cycles. | 1824 // If not immediate, cycle through 2 more complete cycles. |
| 1825 throbbing_view_->StartThrobbing(immediate ? 0 : 4); | 1825 throbbing_view_->StartThrobbing(immediate ? 0 : 4); |
| 1826 throbbing_view_ = NULL; | 1826 throbbing_view_ = NULL; |
| 1827 } | 1827 } |
| OLD | NEW |