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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 bool GetTooltipText(const gfx::Point& p, | 272 bool GetTooltipText(const gfx::Point& p, |
273 base::string16* tooltip_text) const override { | 273 base::string16* tooltip_text) const override { |
274 const views::TooltipManager* tooltip_manager = | 274 const views::TooltipManager* tooltip_manager = |
275 GetWidget()->GetTooltipManager(); | 275 GetWidget()->GetTooltipManager(); |
276 gfx::Point location(p); | 276 gfx::Point location(p); |
277 ConvertPointToScreen(this, &location); | 277 ConvertPointToScreen(this, &location); |
278 // Also update when the maximum width for tooltip has changed because the | 278 // Also update when the maximum width for tooltip has changed because the |
279 // it may be elided differently. | 279 // it may be elided differently. |
280 int max_tooltip_width = tooltip_manager->GetMaxWidth(location); | 280 int max_tooltip_width = tooltip_manager->GetMaxWidth(location); |
281 if (tooltip_text_.empty() || max_tooltip_width != max_tooltip_width_) { | 281 if (tooltip_text_.empty() || max_tooltip_width != max_tooltip_width_) { |
282 LOG(ERROR) << "New Tooltip:" << tooltip_text_; | |
sky
2017/02/09 20:30:40
Remove this.
oshima
2017/02/13 04:37:24
Done.
| |
282 max_tooltip_width_ = max_tooltip_width; | 283 max_tooltip_width_ = max_tooltip_width; |
283 tooltip_text_ = BookmarkBarView::CreateToolTipForURLAndTitle( | 284 tooltip_text_ = BookmarkBarView::CreateToolTipForURLAndTitle( |
284 max_tooltip_width_, tooltip_manager->GetFontList(), url_, GetText()); | 285 max_tooltip_width_, tooltip_manager->GetFontList(), url_, GetText()); |
285 } | 286 } |
286 *tooltip_text = tooltip_text_; | 287 *tooltip_text = tooltip_text_; |
287 return !tooltip_text->empty(); | 288 return !tooltip_text->empty(); |
288 } | 289 } |
289 | 290 |
290 void SetText(const base::string16& text) override { | 291 void SetText(const base::string16& text) override { |
291 BookmarkButtonBase::SetText(text); | 292 BookmarkButtonBase::SetText(text); |
292 tooltip_text_.empty(); | 293 tooltip_text_.clear(); |
293 } | 294 } |
294 | 295 |
295 const char* GetClassName() const override { return kViewClassName; } | 296 const char* GetClassName() const override { return kViewClassName; } |
296 | 297 |
297 private: | 298 private: |
298 // A cached value of maximum width for tooltip to skip generating | 299 // A cached value of maximum width for tooltip to skip generating |
299 // new tooltip text. | 300 // new tooltip text. |
300 mutable int max_tooltip_width_ = 0; | 301 mutable int max_tooltip_width_ = 0; |
301 mutable base::string16 tooltip_text_; | 302 mutable base::string16 tooltip_text_; |
302 const GURL& url_; | 303 const GURL& url_; |
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2148 return; | 2149 return; |
2149 apps_page_shortcut_->SetVisible(visible); | 2150 apps_page_shortcut_->SetVisible(visible); |
2150 UpdateBookmarksSeparatorVisibility(); | 2151 UpdateBookmarksSeparatorVisibility(); |
2151 LayoutAndPaint(); | 2152 LayoutAndPaint(); |
2152 } | 2153 } |
2153 | 2154 |
2154 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2155 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2155 if (UpdateOtherAndManagedButtonsVisibility()) | 2156 if (UpdateOtherAndManagedButtonsVisibility()) |
2156 LayoutAndPaint(); | 2157 LayoutAndPaint(); |
2157 } | 2158 } |
OLD | NEW |