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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (BookmarkBarView::testing_) { | 222 if (BookmarkBarView::testing_) { |
223 // For some reason during testing the events generated by animating | 223 // For some reason during testing the events generated by animating |
224 // throw off the test. So, don't animate while testing. | 224 // throw off the test. So, don't animate while testing. |
225 show_animation_->Reset(1); | 225 show_animation_->Reset(1); |
226 } else { | 226 } else { |
227 show_animation_->Show(); | 227 show_animation_->Show(); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 virtual bool IsTriggerableEvent(const views::MouseEvent& e) { | 231 virtual bool IsTriggerableEvent(const views::MouseEvent& e) { |
232 // This is hard coded to avoid potential notification on left mouse down, | 232 // Left clicks should show the menu contents and right clicks should show |
233 // which we want to show the menu. | 233 // the context menu. They should not trigger the opening of underlying urls. |
234 return e.IsMiddleMouseButton(); | 234 if (e.GetFlags() == views::MouseEvent::EF_LEFT_BUTTON_DOWN || |
| 235 e.GetFlags() == views::MouseEvent::EF_RIGHT_BUTTON_DOWN) |
| 236 return false; |
| 237 |
| 238 WindowOpenDisposition disposition( |
| 239 event_utils::DispositionFromEventFlags(e.GetFlags())); |
| 240 return disposition != CURRENT_TAB; |
235 } | 241 } |
236 | 242 |
237 virtual void Paint(gfx::Canvas *canvas) { | 243 virtual void Paint(gfx::Canvas *canvas) { |
238 views::MenuButton::Paint(canvas, false); | 244 views::MenuButton::Paint(canvas, false); |
239 } | 245 } |
240 | 246 |
241 private: | 247 private: |
242 scoped_ptr<SlideAnimation> show_animation_; | 248 scoped_ptr<SlideAnimation> show_animation_; |
243 | 249 |
244 DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton); | 250 DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton); |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 // to the user. | 1736 // to the user. |
1731 sync_error_button->SetTooltipText( | 1737 sync_error_button->SetTooltipText( |
1732 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1738 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
1733 sync_error_button->SetAccessibleName( | 1739 sync_error_button->SetAccessibleName( |
1734 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1740 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
1735 sync_error_button->SetIcon( | 1741 sync_error_button->SetIcon( |
1736 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1742 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
1737 return sync_error_button; | 1743 return sync_error_button; |
1738 } | 1744 } |
1739 #endif // defined(BROWSER_SYNC) | 1745 #endif // defined(BROWSER_SYNC) |
OLD | NEW |