| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "ui/gfx/animation/animation_delegate.h" | 27 #include "ui/gfx/animation/animation_delegate.h" |
| 28 #include "ui/gfx/animation/linear_animation.h" | 28 #include "ui/gfx/animation/linear_animation.h" |
| 29 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
| 30 #include "ui/gfx/font_list.h" | 30 #include "ui/gfx/font_list.h" |
| 31 #include "ui/gfx/geometry/point.h" | 31 #include "ui/gfx/geometry/point.h" |
| 32 #include "ui/gfx/geometry/rect.h" | 32 #include "ui/gfx/geometry/rect.h" |
| 33 #include "ui/gfx/skia_util.h" | 33 #include "ui/gfx/skia_util.h" |
| 34 #include "ui/gfx/text_elider.h" | 34 #include "ui/gfx/text_elider.h" |
| 35 #include "ui/gfx/text_utils.h" | 35 #include "ui/gfx/text_utils.h" |
| 36 #include "ui/native_theme/native_theme.h" | 36 #include "ui/native_theme/native_theme.h" |
| 37 #include "ui/views/controls/scrollbar/native_scroll_bar.h" | 37 #include "ui/views/controls/scrollbar/scroll_bar_views.h" |
| 38 #include "ui/views/widget/root_view.h" | 38 #include "ui/views/widget/root_view.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 #include "url/gurl.h" | 40 #include "url/gurl.h" |
| 41 | 41 |
| 42 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
| 43 #include "ash/common/wm/window_state.h" // nogncheck | 43 #include "ash/common/wm/window_state.h" // nogncheck |
| 44 #include "ash/wm/window_state_aura.h" // nogncheck | 44 #include "ash/wm/window_state_aura.h" // nogncheck |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(USE_AURA) | 47 #if defined(USE_AURA) |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 is_expanded_ = true; | 929 is_expanded_ = true; |
| 930 expand_view_->StartExpansion(url_text_, size_.width(), expanded_bubble_width); | 930 expand_view_->StartExpansion(url_text_, size_.width(), expanded_bubble_width); |
| 931 } | 931 } |
| 932 | 932 |
| 933 int StatusBubbleViews::GetStandardStatusBubbleWidth() { | 933 int StatusBubbleViews::GetStandardStatusBubbleWidth() { |
| 934 return base_view_->bounds().width() / 3; | 934 return base_view_->bounds().width() / 3; |
| 935 } | 935 } |
| 936 | 936 |
| 937 int StatusBubbleViews::GetMaxStatusBubbleWidth() { | 937 int StatusBubbleViews::GetMaxStatusBubbleWidth() { |
| 938 const ui::NativeTheme* theme = base_view_->GetNativeTheme(); | 938 const ui::NativeTheme* theme = base_view_->GetNativeTheme(); |
| 939 return static_cast<int>(std::max(0, base_view_->bounds().width() - | 939 return static_cast<int>( |
| 940 (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding - 1 - | 940 std::max(0, base_view_->bounds().width() - (kShadowThickness * 2) - |
| 941 views::NativeScrollBar::GetVerticalScrollBarWidth(theme))); | 941 kTextPositionX - kTextHorizPadding - 1 - |
| 942 views::ScrollBarViews::GetVerticalScrollBarWidth(theme))); |
| 942 } | 943 } |
| 943 | 944 |
| 944 void StatusBubbleViews::SetBubbleWidth(int width) { | 945 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 945 size_.set_width(width); | 946 size_.set_width(width); |
| 946 SetBounds(original_position_.x(), original_position_.y(), | 947 SetBounds(original_position_.x(), original_position_.y(), |
| 947 size_.width(), size_.height()); | 948 size_.width(), size_.height()); |
| 948 } | 949 } |
| 949 | 950 |
| 950 void StatusBubbleViews::CancelExpandTimer() { | 951 void StatusBubbleViews::CancelExpandTimer() { |
| 951 if (expand_timer_factory_.HasWeakPtrs()) | 952 if (expand_timer_factory_.HasWeakPtrs()) |
| 952 expand_timer_factory_.InvalidateWeakPtrs(); | 953 expand_timer_factory_.InvalidateWeakPtrs(); |
| 953 } | 954 } |
| OLD | NEW |