| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ime/mode_indicator_view.h" | 5 #include "ash/ime/mode_indicator_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/gfx/display.h" | 8 #include "ui/gfx/display.h" |
| 9 #include "ui/gfx/screen.h" | 9 #include "ui/gfx/screen.h" |
| 10 #include "ui/views/bubble/bubble_delegate.h" | 10 #include "ui/views/bubble/bubble_delegate.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 wm::SetWindowVisibilityAnimationTransition( | 61 wm::SetWindowVisibilityAnimationTransition( |
| 62 GetWidget()->GetNativeView(), | 62 GetWidget()->GetNativeView(), |
| 63 wm::ANIMATE_HIDE); | 63 wm::ANIMATE_HIDE); |
| 64 GetWidget()->Show(); | 64 GetWidget()->Show(); |
| 65 timer_.Start(FROM_HERE, | 65 timer_.Start(FROM_HERE, |
| 66 base::TimeDelta::FromMilliseconds(kShowingDuration), | 66 base::TimeDelta::FromMilliseconds(kShowingDuration), |
| 67 GetWidget(), | 67 GetWidget(), |
| 68 &views::Widget::Close); | 68 &views::Widget::Close); |
| 69 } | 69 } |
| 70 | 70 |
| 71 gfx::Size ModeIndicatorView::GetPreferredSize() { | 71 gfx::Size ModeIndicatorView::GetPreferredSize() const { |
| 72 gfx::Size size = label_view_->GetPreferredSize(); | 72 gfx::Size size = label_view_->GetPreferredSize(); |
| 73 size.SetToMax(gfx::Size(kMinSize, kMinSize)); | 73 size.SetToMax(gfx::Size(kMinSize, kMinSize)); |
| 74 return size; | 74 return size; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ModeIndicatorView::Init() { | 77 void ModeIndicatorView::Init() { |
| 78 SetLayoutManager(new views::FillLayout()); | 78 SetLayoutManager(new views::FillLayout()); |
| 79 AddChildView(label_view_); | 79 AddChildView(label_view_); |
| 80 | 80 |
| 81 SetAnchorRect(cursor_bounds_); | 81 SetAnchorRect(cursor_bounds_); |
| 82 } | 82 } |
| 83 | 83 |
| 84 views::NonClientFrameView* ModeIndicatorView::CreateNonClientFrameView( | 84 views::NonClientFrameView* ModeIndicatorView::CreateNonClientFrameView( |
| 85 views::Widget* widget) { | 85 views::Widget* widget) { |
| 86 views::BubbleFrameView* frame = new ModeIndicatorFrameView(margins()); | 86 views::BubbleFrameView* frame = new ModeIndicatorFrameView(margins()); |
| 87 // arrow adjustment in BubbleDelegateView is unnecessary because arrow | 87 // arrow adjustment in BubbleDelegateView is unnecessary because arrow |
| 88 // of this bubble is always center. | 88 // of this bubble is always center. |
| 89 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( | 89 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( |
| 90 new views::BubbleBorder(arrow(), shadow(), color()))); | 90 new views::BubbleBorder(arrow(), shadow(), color()))); |
| 91 return frame; | 91 return frame; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace ime | 94 } // namespace ime |
| 95 } // namespace ash | 95 } // namespace ash |
| OLD | NEW |