| 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 "ui/chromeos/ime/mode_indicator_view.h" | 5 #include "ui/chromeos/ime/mode_indicator_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/display.h" | 9 #include "ui/display/display.h" |
| 10 #include "ui/gfx/screen.h" | 10 #include "ui/display/screen.h" |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
| 12 #include "ui/views/bubble/bubble_frame_view.h" | 12 #include "ui/views/bubble/bubble_frame_view.h" |
| 13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/layout/fill_layout.h" | 14 #include "ui/views/layout/fill_layout.h" |
| 15 #include "ui/wm/core/window_animations.h" | 15 #include "ui/wm/core/window_animations.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 namespace ime { | 18 namespace ime { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Minimum size of inner contents in pixel. | 22 // Minimum size of inner contents in pixel. |
| 23 // 43 is the designed size including the default margin (6 * 2). | 23 // 43 is the designed size including the default margin (6 * 2). |
| 24 const int kMinSize = 31; | 24 const int kMinSize = 31; |
| 25 | 25 |
| 26 // After this duration in msec, the mode inicator will be fading out. | 26 // After this duration in msec, the mode inicator will be fading out. |
| 27 const int kShowingDuration = 500; | 27 const int kShowingDuration = 500; |
| 28 | 28 |
| 29 class ModeIndicatorFrameView : public views::BubbleFrameView { | 29 class ModeIndicatorFrameView : public views::BubbleFrameView { |
| 30 public: | 30 public: |
| 31 explicit ModeIndicatorFrameView(const gfx::Insets& content_margins) | 31 explicit ModeIndicatorFrameView(const gfx::Insets& content_margins) |
| 32 : views::BubbleFrameView(gfx::Insets(), content_margins) {} | 32 : views::BubbleFrameView(gfx::Insets(), content_margins) {} |
| 33 ~ModeIndicatorFrameView() override {} | 33 ~ModeIndicatorFrameView() override {} |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // views::BubbleFrameView overrides: | 36 // views::BubbleFrameView overrides: |
| 37 gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const override { | 37 gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const override { |
| 38 return gfx::Screen::GetScreen() | 38 return display::Screen::GetScreen() |
| 39 ->GetDisplayNearestPoint(rect.CenterPoint()) | 39 ->GetDisplayNearestPoint(rect.CenterPoint()) |
| 40 .bounds(); | 40 .bounds(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(ModeIndicatorFrameView); | 43 DISALLOW_COPY_AND_ASSIGN(ModeIndicatorFrameView); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 | 48 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 views::BubbleFrameView* frame = new ModeIndicatorFrameView(margins()); | 97 views::BubbleFrameView* frame = new ModeIndicatorFrameView(margins()); |
| 98 // arrow adjustment in BubbleDialogDelegateView is unnecessary because arrow | 98 // arrow adjustment in BubbleDialogDelegateView is unnecessary because arrow |
| 99 // of this bubble is always center. | 99 // of this bubble is always center. |
| 100 frame->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>( | 100 frame->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>( |
| 101 new views::BubbleBorder(arrow(), shadow(), color()))); | 101 new views::BubbleBorder(arrow(), shadow(), color()))); |
| 102 return frame; | 102 return frame; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace ime | 105 } // namespace ime |
| 106 } // namespace ui | 106 } // namespace ui |
| OLD | NEW |