OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 show_animation_.reset(new ui::SlideAnimation(this)); | 188 show_animation_.reset(new ui::SlideAnimation(this)); |
189 if (BookmarkBarView::testing_) { | 189 if (BookmarkBarView::testing_) { |
190 // For some reason during testing the events generated by animating | 190 // For some reason during testing the events generated by animating |
191 // throw off the test. So, don't animate while testing. | 191 // throw off the test. So, don't animate while testing. |
192 show_animation_->Reset(1); | 192 show_animation_->Reset(1); |
193 } else { | 193 } else { |
194 show_animation_->Show(); | 194 show_animation_->Show(); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { | |
Alexei Svitkine (slow)
2011/07/07 19:58:56
Please use virtual and OVERRIDE here (like |IsTrig
PhilBeaudoin
2011/07/07 20:26:17
Done.
| |
199 gfx::Point location(p); | |
sky
2011/07/07 20:07:16
It doesn't look 199 and 200 are needed.
PhilBeaudoin
2011/07/07 20:26:17
Done.
| |
200 ConvertPointToScreen(this, &location); | |
201 if (text_size_.width() > GetTextBounds().width()) { | |
sky
2011/07/07 20:07:16
no {}
PhilBeaudoin
2011/07/07 20:26:17
Done.
| |
202 *tooltip = text_; | |
203 } | |
204 return !tooltip->empty(); | |
205 } | |
206 | |
198 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE { | 207 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE { |
199 // Left clicks should show the menu contents and right clicks should show | 208 // Left clicks should show the menu contents and right clicks should show |
200 // the context menu. They should not trigger the opening of underlying urls. | 209 // the context menu. They should not trigger the opening of underlying urls. |
201 if (e.flags() == ui::EF_LEFT_BUTTON_DOWN || | 210 if (e.flags() == ui::EF_LEFT_BUTTON_DOWN || |
202 e.flags() == ui::EF_RIGHT_BUTTON_DOWN) | 211 e.flags() == ui::EF_RIGHT_BUTTON_DOWN) |
203 return false; | 212 return false; |
204 | 213 |
205 WindowOpenDisposition disposition( | 214 WindowOpenDisposition disposition( |
206 event_utils::DispositionFromEventFlags(e.flags())); | 215 event_utils::DispositionFromEventFlags(e.flags())); |
207 return disposition != CURRENT_TAB; | 216 return disposition != CURRENT_TAB; |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1746 (1 - size_animation_->GetCurrentValue()))); | 1755 (1 - size_animation_->GetCurrentValue()))); |
1747 } else { | 1756 } else { |
1748 prefsize.set_height( | 1757 prefsize.set_height( |
1749 static_cast<int>( | 1758 static_cast<int>( |
1750 browser_defaults::kBookmarkBarHeight * | 1759 browser_defaults::kBookmarkBarHeight * |
1751 size_animation_->GetCurrentValue())); | 1760 size_animation_->GetCurrentValue())); |
1752 } | 1761 } |
1753 } | 1762 } |
1754 return prefsize; | 1763 return prefsize; |
1755 } | 1764 } |
OLD | NEW |