| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 show_animation_->Reset(1); | 157 show_animation_->Reset(1); |
| 158 } else { | 158 } else { |
| 159 show_animation_->Show(); | 159 show_animation_->Show(); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 virtual bool GetTooltipText(const gfx::Point& p, | 163 virtual bool GetTooltipText(const gfx::Point& p, |
| 164 string16* tooltip) const OVERRIDE { | 164 string16* tooltip) const OVERRIDE { |
| 165 gfx::Point location(p); | 165 gfx::Point location(p); |
| 166 ConvertPointToScreen(this, &location); | 166 ConvertPointToScreen(this, &location); |
| 167 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_, | 167 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle( |
| 168 text(), profile_); | 168 location, url_, text(), profile_, GetWidget()->GetNativeView()); |
| 169 return !tooltip->empty(); | 169 return !tooltip->empty(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE { | 172 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE { |
| 173 return e.type() == ui::ET_GESTURE_TAP || | 173 return e.type() == ui::ET_GESTURE_TAP || |
| 174 e.type() == ui::ET_GESTURE_TAP_DOWN || | 174 e.type() == ui::ET_GESTURE_TAP_DOWN || |
| 175 event_utils::IsPossibleDispositionEvent(e); | 175 event_utils::IsPossibleDispositionEvent(e); |
| 176 } | 176 } |
| 177 | 177 |
| 178 virtual std::string GetClassName() const OVERRIDE { | 178 virtual std::string GetClassName() const OVERRIDE { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 // If not immediate, cycle through 2 more complete cycles. | 530 // If not immediate, cycle through 2 more complete cycles. |
| 531 throbbing_view_->StartThrobbing(immediate ? 0 : 4); | 531 throbbing_view_->StartThrobbing(immediate ? 0 : 4); |
| 532 throbbing_view_ = NULL; | 532 throbbing_view_ = NULL; |
| 533 } | 533 } |
| 534 | 534 |
| 535 // static | 535 // static |
| 536 string16 BookmarkBarView::CreateToolTipForURLAndTitle( | 536 string16 BookmarkBarView::CreateToolTipForURLAndTitle( |
| 537 const gfx::Point& screen_loc, | 537 const gfx::Point& screen_loc, |
| 538 const GURL& url, | 538 const GURL& url, |
| 539 const string16& title, | 539 const string16& title, |
| 540 Profile* profile) { | 540 Profile* profile, |
| 541 gfx::NativeView context) { |
| 541 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(), | 542 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(), |
| 542 screen_loc.y()); | 543 screen_loc.y(), |
| 544 context); |
| 543 gfx::Font tt_font = views::TooltipManager::GetDefaultFont(); | 545 gfx::Font tt_font = views::TooltipManager::GetDefaultFont(); |
| 544 string16 result; | 546 string16 result; |
| 545 | 547 |
| 546 // First the title. | 548 // First the title. |
| 547 if (!title.empty()) { | 549 if (!title.empty()) { |
| 548 string16 localized_title = title; | 550 string16 localized_title = title; |
| 549 base::i18n::AdjustStringForLocaleDirection(&localized_title); | 551 base::i18n::AdjustStringForLocaleDirection(&localized_title); |
| 550 result.append(ui::ElideText(localized_title, tt_font, max_width, | 552 result.append(ui::ElideText(localized_title, tt_font, max_width, |
| 551 ui::ELIDE_AT_END)); | 553 ui::ELIDE_AT_END)); |
| 552 } | 554 } |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 (1 - size_animation_->GetCurrentValue()))); | 1684 (1 - size_animation_->GetCurrentValue()))); |
| 1683 } else { | 1685 } else { |
| 1684 prefsize.set_height( | 1686 prefsize.set_height( |
| 1685 static_cast<int>( | 1687 static_cast<int>( |
| 1686 browser_defaults::kBookmarkBarHeight * | 1688 browser_defaults::kBookmarkBarHeight * |
| 1687 size_animation_->GetCurrentValue())); | 1689 size_animation_->GetCurrentValue())); |
| 1688 } | 1690 } |
| 1689 } | 1691 } |
| 1690 return prefsize; | 1692 return prefsize; |
| 1691 } | 1693 } |
| OLD | NEW |