OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/shelf/shelf_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf_view.h" | 9 #include "ash/shelf/shelf_view.h" |
10 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/wm_shelf.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 views::BubbleDialogDelegateView::CreateBubble(this); | 91 views::BubbleDialogDelegateView::CreateBubble(this); |
92 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 92 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
93 // These must both be called after CreateBubble. | 93 // These must both be called after CreateBubble. |
94 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | 94 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
95 SetBorderInteriorThickness(kBorderInteriorThickness); | 95 SetBorderInteriorThickness(kBorderInteriorThickness); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 // BubbleDialogDelegateView overrides: | 100 // BubbleDialogDelegateView overrides: |
101 gfx::Size GetPreferredSize() const override { | 101 gfx::Size CalculatePreferredSize() const override { |
102 const gfx::Size size = BubbleDialogDelegateView::GetPreferredSize(); | 102 const gfx::Size size = BubbleDialogDelegateView::GetPreferredSize(); |
103 const int kTooltipMinHeight = kTooltipHeight - 2 * kTooltipTopBottomMargin; | 103 const int kTooltipMinHeight = kTooltipHeight - 2 * kTooltipTopBottomMargin; |
104 return gfx::Size(std::min(size.width(), kTooltipMaxWidth), | 104 return gfx::Size(std::min(size.width(), kTooltipMaxWidth), |
105 std::max(size.height(), kTooltipMinHeight)); | 105 std::max(size.height(), kTooltipMinHeight)); |
106 } | 106 } |
107 | 107 |
108 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, | 108 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, |
109 views::Widget* bubble_widget) const override { | 109 views::Widget* bubble_widget) const override { |
110 // Place the bubble in the same display as the anchor. | 110 // Place the bubble in the same display as the anchor. |
111 WmWindow::Get(anchor_widget()->GetNativeWindow()) | 111 WmWindow::Get(anchor_widget()->GetNativeWindow()) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { | 255 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { |
256 WmShelf* shelf = shelf_view_ ? shelf_view_->wm_shelf() : nullptr; | 256 WmShelf* shelf = shelf_view_ ? shelf_view_->wm_shelf() : nullptr; |
257 return shelf && shelf_view_->ShouldShowTooltipForView(view) && | 257 return shelf && shelf_view_->ShouldShowTooltipForView(view) && |
258 (shelf->GetVisibilityState() == SHELF_VISIBLE || | 258 (shelf->GetVisibilityState() == SHELF_VISIBLE || |
259 (shelf->GetVisibilityState() == SHELF_AUTO_HIDE && | 259 (shelf->GetVisibilityState() == SHELF_AUTO_HIDE && |
260 shelf->GetAutoHideState() == SHELF_AUTO_HIDE_SHOWN)); | 260 shelf->GetAutoHideState() == SHELF_AUTO_HIDE_SHOWN)); |
261 } | 261 } |
262 | 262 |
263 } // namespace ash | 263 } // namespace ash |
OLD | NEW |