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/status_bubble_views.h" | 5 #include "chrome/browser/ui/views/status_bubble_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
15 #include "chrome/browser/ui/elide_url.h" | 15 #include "chrome/browser/ui/elide_url.h" |
16 #include "net/base/net_util.h" | 16 #include "components/url_formatter/url_formatter.h" |
17 #include "third_party/skia/include/core/SkPaint.h" | 17 #include "third_party/skia/include/core/SkPaint.h" |
18 #include "third_party/skia/include/core/SkRect.h" | 18 #include "third_party/skia/include/core/SkRect.h" |
19 #include "ui/base/theme_provider.h" | 19 #include "ui/base/theme_provider.h" |
20 #include "ui/gfx/animation/animation_delegate.h" | 20 #include "ui/gfx/animation/animation_delegate.h" |
21 #include "ui/gfx/animation/linear_animation.h" | 21 #include "ui/gfx/animation/linear_animation.h" |
22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
24 #include "ui/gfx/geometry/point.h" | 24 #include "ui/gfx/geometry/point.h" |
25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
26 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 691 |
692 if (IsFrameVisible()) { | 692 if (IsFrameVisible()) { |
693 view_->SetText(url_text_, true); | 693 view_->SetText(url_text_, true); |
694 | 694 |
695 CancelExpandTimer(); | 695 CancelExpandTimer(); |
696 | 696 |
697 // If bubble is already in expanded state, shift to adjust to new text | 697 // If bubble is already in expanded state, shift to adjust to new text |
698 // size (shrinking or expanding). Otherwise delay. | 698 // size (shrinking or expanding). Otherwise delay. |
699 if (is_expanded_ && !url.is_empty()) { | 699 if (is_expanded_ && !url.is_empty()) { |
700 ExpandBubble(); | 700 ExpandBubble(); |
701 } else if (net::FormatUrl(url, languages).length() > url_text_.length()) { | 701 } else if (url_formatter::FormatUrl(url, languages).length() > |
| 702 url_text_.length()) { |
702 base::MessageLoop::current()->PostDelayedTask( | 703 base::MessageLoop::current()->PostDelayedTask( |
703 FROM_HERE, | 704 FROM_HERE, |
704 base::Bind(&StatusBubbleViews::ExpandBubble, | 705 base::Bind(&StatusBubbleViews::ExpandBubble, |
705 expand_timer_factory_.GetWeakPtr()), | 706 expand_timer_factory_.GetWeakPtr()), |
706 base::TimeDelta::FromMilliseconds(kExpandHoverDelayMS)); | 707 base::TimeDelta::FromMilliseconds(kExpandHoverDelayMS)); |
707 } | 708 } |
708 } | 709 } |
709 } | 710 } |
710 | 711 |
711 void StatusBubbleViews::Hide() { | 712 void StatusBubbleViews::Hide() { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 void StatusBubbleViews::SetBubbleWidth(int width) { | 873 void StatusBubbleViews::SetBubbleWidth(int width) { |
873 size_.set_width(width); | 874 size_.set_width(width); |
874 SetBounds(original_position_.x(), original_position_.y(), | 875 SetBounds(original_position_.x(), original_position_.y(), |
875 size_.width(), size_.height()); | 876 size_.width(), size_.height()); |
876 } | 877 } |
877 | 878 |
878 void StatusBubbleViews::CancelExpandTimer() { | 879 void StatusBubbleViews::CancelExpandTimer() { |
879 if (expand_timer_factory_.HasWeakPtrs()) | 880 if (expand_timer_factory_.HasWeakPtrs()) |
880 expand_timer_factory_.InvalidateWeakPtrs(); | 881 expand_timer_factory_.InvalidateWeakPtrs(); |
881 } | 882 } |
OLD | NEW |