Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: ash/launcher/launcher_tooltip_manager.cc

Issue 10834207: aura: Long launcher tooltips should elide at end. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/label.h » ('j') | ui/views/controls/label.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/launcher/launcher_tooltip_manager.h" 5 #include "ash/launcher/launcher_tooltip_manager.h"
6 6
7 #include "ash/launcher/launcher_view.h" 7 #include "ash/launcher/launcher_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/window_animations.h" 10 #include "ash/wm/window_animations.h"
(...skipping 13 matching lines...) Expand all
24 #include "ui/views/layout/fill_layout.h" 24 #include "ui/views/layout/fill_layout.h"
25 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
26 26
27 namespace ash { 27 namespace ash {
28 namespace internal { 28 namespace internal {
29 namespace { 29 namespace {
30 const int kTooltipTopBottomMargin = 3; 30 const int kTooltipTopBottomMargin = 3;
31 const int kTooltipLeftRightMargin = 10; 31 const int kTooltipLeftRightMargin = 10;
32 const int kTooltipAppearanceDelay = 200; // msec 32 const int kTooltipAppearanceDelay = 200; // msec
33 const int kTooltipMinHeight = 29 - 2 * kTooltipTopBottomMargin; 33 const int kTooltipMinHeight = 29 - 2 * kTooltipTopBottomMargin;
34 const SkColor kTooltipTextColor = SkColorSetRGB(22, 22, 22); 34 const SkColor kTooltipTextColor = SkColorSetRGB(0x22, 0x22, 0x22);
35 35
36 // The maximum width of the tooltip bubble. Borrowed the value from 36 // The maximum width of the tooltip bubble. Borrowed the value from
37 // ash/tooltip/tooltip_controller.cc 37 // ash/tooltip/tooltip_controller.cc
38 const int kTooltipMaxWidth = 250; 38 const int kTooltipMaxWidth = 250;
39 39
40 // Bubble border metrics 40 // Bubble border metrics
41 const int kArrowHeight = 7; 41 const int kArrowHeight = 7;
42 const int kArrowWidth = 15; 42 const int kArrowWidth = 15;
43 const int kShadowWidth = 8; 43 const int kShadowWidth = 8;
44 // The distance between the arrow tip and edge of the anchor view. 44 // The distance between the arrow tip and edge of the anchor view.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // The anchor may not have the widget in tests. 102 // The anchor may not have the widget in tests.
103 if (anchor->GetWidget() && anchor->GetWidget()->GetNativeView()) { 103 if (anchor->GetWidget() && anchor->GetWidget()->GetNativeView()) {
104 aura::RootWindow* root_window = 104 aura::RootWindow* root_window =
105 anchor->GetWidget()->GetNativeView()->GetRootWindow(); 105 anchor->GetWidget()->GetNativeView()->GetRootWindow();
106 set_parent_window(ash::Shell::GetInstance()->GetContainer( 106 set_parent_window(ash::Shell::GetInstance()->GetContainer(
107 root_window, ash::internal::kShellWindowId_SettingBubbleContainer)); 107 root_window, ash::internal::kShellWindowId_SettingBubbleContainer));
108 } 108 }
109 label_ = new views::Label; 109 label_ = new views::Label;
110 label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 110 label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
111 label_->SetEnabledColor(kTooltipTextColor); 111 label_->SetEnabledColor(kTooltipTextColor);
112 label_->set_elide_at_end(true);
112 AddChildView(label_); 113 AddChildView(label_);
113 views::BubbleDelegateView::CreateBubble(this); 114 views::BubbleDelegateView::CreateBubble(this);
114 bubble_border_ = new views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT); 115 bubble_border_ = new views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT);
115 bubble_border_->SetShadow(gfx::ShadowValue( 116 bubble_border_->SetShadow(gfx::ShadowValue(
116 gfx::Point(0, 5), kShadowWidth, SkColorSetARGB(0x72, 0, 0, 0))); 117 gfx::Point(0, 5), kShadowWidth, SkColorSetARGB(0x72, 0, 0, 0)));
117 bubble_border_->set_arrow_width(kArrowWidth); 118 bubble_border_->set_arrow_width(kArrowWidth);
118 bubble_border_->set_arrow_height(kArrowHeight); 119 bubble_border_->set_arrow_height(kArrowHeight);
119 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset, 120 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset,
120 kArrowOffset)); 121 kArrowOffset));
121 GetBubbleFrameView()->SetBubbleBorder(bubble_border_); 122 GetBubbleFrameView()->SetBubbleBorder(bubble_border_);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 view_->SetText(text_); 405 view_->SetText(text_);
405 406
406 gfx::NativeView native_view = widget_->GetNativeView(); 407 gfx::NativeView native_view = widget_->GetNativeView();
407 SetWindowVisibilityAnimationType( 408 SetWindowVisibilityAnimationType(
408 native_view, WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); 409 native_view, WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL);
409 SetWindowVisibilityAnimationTransition(native_view, ANIMATE_HIDE); 410 SetWindowVisibilityAnimationTransition(native_view, ANIMATE_HIDE);
410 } 411 }
411 412
412 } // namespace internal 413 } // namespace internal
413 } // namespace ash 414 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/label.h » ('j') | ui/views/controls/label.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698