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 <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 "browser/ui/views/bookmarks/BookmarkButton"; | 183 "browser/ui/views/bookmarks/BookmarkButton"; |
184 | 184 |
185 // BookmarkFolderButton ------------------------------------------------------- | 185 // BookmarkFolderButton ------------------------------------------------------- |
186 | 186 |
187 // Buttons used for folders on the bookmark bar, including the 'other folders' | 187 // Buttons used for folders on the bookmark bar, including the 'other folders' |
188 // button. | 188 // button. |
189 class BookmarkFolderButton : public views::MenuButton { | 189 class BookmarkFolderButton : public views::MenuButton { |
190 public: | 190 public: |
191 BookmarkFolderButton(views::ButtonListener* listener, | 191 BookmarkFolderButton(views::ButtonListener* listener, |
192 const string16& title, | 192 const string16& title, |
193 views::MenuButtonDelegate* menu_delegate, | 193 views::MenuButtonListener* menu_button_listener, |
194 bool show_menu_marker) | 194 bool show_menu_marker) |
195 : MenuButton(listener, title, menu_delegate, show_menu_marker) { | 195 : MenuButton(listener, title, menu_button_listener, show_menu_marker) { |
196 show_animation_.reset(new ui::SlideAnimation(this)); | 196 show_animation_.reset(new ui::SlideAnimation(this)); |
197 if (BookmarkBarView::testing_) { | 197 if (BookmarkBarView::testing_) { |
198 // For some reason during testing the events generated by animating | 198 // For some reason during testing the events generated by animating |
199 // throw off the test. So, don't animate while testing. | 199 // throw off the test. So, don't animate while testing. |
200 show_animation_->Reset(1); | 200 show_animation_->Reset(1); |
201 } else { | 201 } else { |
202 show_animation_->Show(); | 202 show_animation_->Show(); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 menu_button->Activate(); | 988 menu_button->Activate(); |
989 return false; | 989 return false; |
990 } | 990 } |
991 break; | 991 break; |
992 } | 992 } |
993 } | 993 } |
994 } | 994 } |
995 return true; | 995 return true; |
996 } | 996 } |
997 | 997 |
998 void BookmarkBarView::RunMenu(views::View* view, const gfx::Point& pt) { | 998 void BookmarkBarView::OnMenuButtonClicked(views::View* view, |
| 999 const gfx::Point& point) { |
999 const BookmarkNode* node; | 1000 const BookmarkNode* node; |
1000 | 1001 |
1001 int start_index = 0; | 1002 int start_index = 0; |
1002 if (view == other_bookmarked_button_) { | 1003 if (view == other_bookmarked_button_) { |
1003 node = model_->other_node(); | 1004 node = model_->other_node(); |
1004 } else if (view == overflow_button_) { | 1005 } else if (view == overflow_button_) { |
1005 node = model_->bookmark_bar_node(); | 1006 node = model_->bookmark_bar_node(); |
1006 start_index = GetFirstHiddenNodeIndex(); | 1007 start_index = GetFirstHiddenNodeIndex(); |
1007 } else { | 1008 } else { |
1008 int button_index = GetIndexOf(view); | 1009 int button_index = GetIndexOf(view); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 (1 - size_animation_->GetCurrentValue()))); | 1663 (1 - size_animation_->GetCurrentValue()))); |
1663 } else { | 1664 } else { |
1664 prefsize.set_height( | 1665 prefsize.set_height( |
1665 static_cast<int>( | 1666 static_cast<int>( |
1666 browser_defaults::kBookmarkBarHeight * | 1667 browser_defaults::kBookmarkBarHeight * |
1667 size_animation_->GetCurrentValue())); | 1668 size_animation_->GetCurrentValue())); |
1668 } | 1669 } |
1669 } | 1670 } |
1670 return prefsize; | 1671 return prefsize; |
1671 } | 1672 } |
OLD | NEW |