| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/location_bar/icon_label_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/layout_constants.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| 11 #include "ui/views/test/views_test_base.h" | 11 #include "ui/views/test/views_test_base.h" |
| 12 | 12 |
| 13 #if defined(USE_ASH) | 13 #if defined(USE_ASH) |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return STEADY; | 58 return STEADY; |
| 59 } | 59 } |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 // IconLabelBubbleView: | 62 // IconLabelBubbleView: |
| 63 SkColor GetTextColor() const override { return kTestColor; } | 63 SkColor GetTextColor() const override { return kTestColor; } |
| 64 | 64 |
| 65 bool ShouldShowLabel() const override { | 65 bool ShouldShowLabel() const override { |
| 66 return !IsShrinking() || | 66 return !IsShrinking() || |
| 67 (width() > (image()->GetPreferredSize().width() + | 67 (width() > (image()->GetPreferredSize().width() + |
| 68 2 * GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING))); | 68 2 * LocationBarView::kHorizontalPadding)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 double WidthMultiplier() const override { | 71 double WidthMultiplier() const override { |
| 72 const double kOpenFraction = | 72 const double kOpenFraction = |
| 73 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS; | 73 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS; |
| 74 double fraction = value_ / (double)kNumberOfSteps; | 74 double fraction = value_ / (double)kNumberOfSteps; |
| 75 switch (state()) { | 75 switch (state()) { |
| 76 case GROWING: | 76 case GROWING: |
| 77 return fraction / kOpenFraction; | 77 return fraction / kOpenFraction; |
| 78 case STEADY: | 78 case STEADY: |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 widget.GetContentsView()->AddChildView(icon_label_bubble_view); | 241 widget.GetContentsView()->AddChildView(icon_label_bubble_view); |
| 242 aura::Window* widget_native_view = widget.GetNativeView(); | 242 aura::Window* widget_native_view = widget.GetNativeView(); |
| 243 // Remove the window from its parent. This means GetWidget() in | 243 // Remove the window from its parent. This means GetWidget() in |
| 244 // IconLabelBubbleView will return non-null, but GetWidget()->GetCompositor() | 244 // IconLabelBubbleView will return non-null, but GetWidget()->GetCompositor() |
| 245 // will return null. | 245 // will return null. |
| 246 ASSERT_TRUE(widget_native_view->parent()); | 246 ASSERT_TRUE(widget_native_view->parent()); |
| 247 widget_native_view->parent()->RemoveChild(widget_native_view); | 247 widget_native_view->parent()->RemoveChild(widget_native_view); |
| 248 static_cast<views::View*>(icon_label_bubble_view)->GetPreferredSize(); | 248 static_cast<views::View*>(icon_label_bubble_view)->GetPreferredSize(); |
| 249 } | 249 } |
| 250 #endif | 250 #endif |
| OLD | NEW |