OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/setting_level_bubble.h" | 5 #include "chrome/browser/chromeos/setting_level_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/chromeos/login/background_view.h" | 9 #include "chrome/browser/chromeos/login/background_view.h" |
10 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 10 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 namespace chromeos { | 56 namespace chromeos { |
57 | 57 |
58 // SettingLevelBubbleDelegateView ---------------------------------------------- | 58 // SettingLevelBubbleDelegateView ---------------------------------------------- |
59 class SettingLevelBubbleDelegateView : public views::BubbleDelegateView { | 59 class SettingLevelBubbleDelegateView : public views::BubbleDelegateView { |
60 public: | 60 public: |
61 // BubbleDelegate overrides: | 61 // BubbleDelegate overrides: |
62 virtual gfx::Point GetAnchorPoint() OVERRIDE; | 62 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
63 | 63 |
64 // Create the bubble delegate view. | 64 // Create the bubble delegate view. |
65 SettingLevelBubbleDelegateView(); | 65 SettingLevelBubbleDelegateView(); |
66 virtual ~SettingLevelBubbleDelegateView(); | 66 virtual ~SettingLevelBubbleDelegateView(); |
67 | 67 |
68 SettingLevelBubbleView* view() { return view_; } | 68 SettingLevelBubbleView* view() { return view_; } |
69 | 69 |
70 protected: | 70 protected: |
71 // BubbleDelegate overrides: | 71 // BubbleDelegate overrides: |
72 virtual void Init() OVERRIDE; | 72 virtual void Init() OVERRIDE; |
73 | 73 |
74 private: | 74 private: |
75 SettingLevelBubbleView* view_; | 75 SettingLevelBubbleView* view_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleDelegateView); | 77 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleDelegateView); |
78 }; | 78 }; |
79 | 79 |
80 gfx::Point SettingLevelBubbleDelegateView::GetAnchorPoint() { | 80 gfx::Rect SettingLevelBubbleDelegateView::GetAnchorRect() { |
81 gfx::Size view_size = GetPreferredSize(); | 81 gfx::Size view_size = GetPreferredSize(); |
82 // Calculate the position in screen coordinates that the bubble should | 82 // Calculate the position in screen coordinates that the bubble should |
83 // "point" at (since we use BubbleBorder::FLOAT, this position actually | 83 // "point" at (since we use BubbleBorder::FLOAT, this position actually |
84 // specifies the center of the bubble). | 84 // specifies the center of the bubble). |
85 gfx::Rect monitor_area = gfx::Screen::GetMonitorAreaNearestWindow(NULL); | 85 gfx::Rect monitor_area = gfx::Screen::GetMonitorAreaNearestWindow(NULL); |
86 return (gfx::Point( | 86 return (gfx::Rect( |
87 monitor_area.x() + kBubbleXRatio * monitor_area.width(), | 87 monitor_area.x() + kBubbleXRatio * monitor_area.width(), |
88 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap)); | 88 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap, 0, 0)); |
89 } | 89 } |
90 | 90 |
91 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView() | 91 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView() |
92 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT), | 92 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT), |
93 view_(NULL) { | 93 view_(NULL) { |
94 set_close_on_esc(false); | 94 set_close_on_esc(false); |
95 set_use_focusless(true); | 95 set_use_focusless(true); |
96 } | 96 } |
97 | 97 |
98 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { | 98 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 last_target_update_time_ = now; | 256 last_target_update_time_ = now; |
257 } | 257 } |
258 | 258 |
259 void SettingLevelBubble::StopAnimation() { | 259 void SettingLevelBubble::StopAnimation() { |
260 animation_timer_.Stop(); | 260 animation_timer_.Stop(); |
261 is_animating_ = false; | 261 is_animating_ = false; |
262 } | 262 } |
263 | 263 |
264 } // namespace chromeos | 264 } // namespace chromeos |
OLD | NEW |