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 <gdk/gdk.h> | |
10 | |
11 #include "chrome/browser/chromeos/login/background_view.h" | 9 #include "chrome/browser/chromeos/login/background_view.h" |
12 #include "chrome/browser/chromeos/login/login_utils.h" | 10 #include "chrome/browser/chromeos/login/login_utils.h" |
13 #include "chrome/browser/chromeos/login/webui_login_display.h" | 11 #include "chrome/browser/chromeos/login/webui_login_display.h" |
14 #include "chrome/browser/chromeos/setting_level_bubble_view.h" | 12 #include "chrome/browser/chromeos/setting_level_bubble_view.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
18 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
19 #include "chrome/browser/ui/views/bubble/bubble.h" | 17 #include "chrome/browser/ui/views/bubble/bubble.h" |
20 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 118 } |
121 DCHECK(view_ == NULL); | 119 DCHECK(view_ == NULL); |
122 view_ = new SettingLevelBubbleView; | 120 view_ = new SettingLevelBubbleView; |
123 view_->Init(icon, current_percent_, enabled); | 121 view_->Init(icon, current_percent_, enabled); |
124 | 122 |
125 // Calculate the position in screen coordinates that the bubble should | 123 // Calculate the position in screen coordinates that the bubble should |
126 // "point" at (since we use BubbleBorder::FLOAT, this position actually | 124 // "point" at (since we use BubbleBorder::FLOAT, this position actually |
127 // specifies the center of the bubble). | 125 // specifies the center of the bubble). |
128 const gfx::Rect monitor_area = | 126 const gfx::Rect monitor_area = |
129 gfx::Screen::GetMonitorAreaNearestWindow( | 127 gfx::Screen::GetMonitorAreaNearestWindow( |
130 GTK_WIDGET(parent_widget->GetNativeWindow())); | 128 parent_widget->GetNativeView()); |
131 const gfx::Size view_size = view_->GetPreferredSize(); | 129 const gfx::Size view_size = view_->GetPreferredSize(); |
132 const gfx::Rect position_relative_to( | 130 const gfx::Rect position_relative_to( |
133 monitor_area.x() + kBubbleXRatio * monitor_area.width(), | 131 monitor_area.x() + kBubbleXRatio * monitor_area.width(), |
134 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap, | 132 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap, |
135 0, 0); | 133 0, 0); |
136 | 134 |
137 bubble_ = Bubble::ShowFocusless(parent_widget, | 135 bubble_ = Bubble::ShowFocusless(parent_widget, |
138 position_relative_to, | 136 position_relative_to, |
139 views::BubbleBorder::FLOAT, | 137 views::BubbleBorder::FLOAT, |
140 view_, // contents | 138 view_, // contents |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 247 |
250 last_target_update_time_ = now; | 248 last_target_update_time_ = now; |
251 } | 249 } |
252 | 250 |
253 void SettingLevelBubble::StopAnimation() { | 251 void SettingLevelBubble::StopAnimation() { |
254 animation_timer_.Stop(); | 252 animation_timer_.Stop(); |
255 is_animating_ = false; | 253 is_animating_ = false; |
256 } | 254 } |
257 | 255 |
258 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |