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" |
11 #include "chrome/browser/chromeos/login/login_display_host.h" | 11 #include "chrome/browser/chromeos/login/login_display_host.h" |
12 #include "chrome/browser/chromeos/login/login_utils.h" | 12 #include "chrome/browser/chromeos/login/login_utils.h" |
13 #include "chrome/browser/chromeos/login/webui_login_display.h" | 13 #include "chrome/browser/chromeos/login/webui_login_display.h" |
14 #include "chrome/browser/chromeos/setting_level_bubble_view.h" | 14 #include "chrome/browser/chromeos/setting_level_bubble_view.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/views/window.h" |
19 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
20 #include "ui/views/bubble/bubble_delegate.h" | 21 #include "ui/views/bubble/bubble_delegate.h" |
21 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
22 #include "ui/views/widget/root_view.h" | 23 #include "ui/views/widget/root_view.h" |
23 | 24 |
24 #if !defined(USE_AURA) | |
25 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | |
26 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | |
27 #endif | |
28 | |
29 using base::TimeDelta; | 25 using base::TimeDelta; |
30 using base::TimeTicks; | 26 using base::TimeTicks; |
31 using std::max; | 27 using std::max; |
32 using std::min; | 28 using std::min; |
33 | 29 |
34 namespace { | 30 namespace { |
35 | 31 |
36 // How long should the bubble be shown onscreen whenever the setting changes? | 32 // How long should the bubble be shown onscreen whenever the setting changes? |
37 const int kBubbleShowTimeoutMs = 1000; | 33 const int kBubbleShowTimeoutMs = 1000; |
38 | 34 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 current_percent_ = target_percent_; | 177 current_percent_ = target_percent_; |
182 target_time_ = TimeTicks(); | 178 target_time_ = TimeTicks(); |
183 last_animation_update_time_ = TimeTicks(); | 179 last_animation_update_time_ = TimeTicks(); |
184 last_target_update_time_ = TimeTicks(); | 180 last_target_update_time_ = TimeTicks(); |
185 hide_timer_.Stop(); | 181 hide_timer_.Stop(); |
186 StopAnimation(); | 182 StopAnimation(); |
187 } | 183 } |
188 | 184 |
189 SettingLevelBubbleView* SettingLevelBubble::CreateView() { | 185 SettingLevelBubbleView* SettingLevelBubble::CreateView() { |
190 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView; | 186 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView; |
191 views::Widget* widget = views::BubbleDelegateView::CreateBubble(delegate); | 187 views::Widget* widget = browser::CreateViewsBubbleAboveLockScreen(delegate); |
192 widget->AddObserver(this); | 188 widget->AddObserver(this); |
193 | |
194 #if !defined(USE_AURA) | |
195 { | |
196 std::vector<int> params; | |
197 params.push_back(1); // show_while_screen_is_locked_ | |
198 chromeos::WmIpc::instance()->SetWindowType( | |
199 widget->GetNativeView(), | |
200 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, | |
201 ¶ms); | |
202 } | |
203 #endif | |
204 | |
205 // Hold on to the content view. | 189 // Hold on to the content view. |
206 return delegate->view(); | 190 return delegate->view(); |
207 } | 191 } |
208 | 192 |
209 void SettingLevelBubble::OnHideTimeout() { | 193 void SettingLevelBubble::OnHideTimeout() { |
210 // Start fading away. | 194 // Start fading away. |
211 if (view_) { | 195 if (view_) { |
212 SettingLevelBubbleDelegateView* delegate = | 196 SettingLevelBubbleDelegateView* delegate = |
213 static_cast<SettingLevelBubbleDelegateView*> | 197 static_cast<SettingLevelBubbleDelegateView*> |
214 (view_->GetWidget()->widget_delegate()); | 198 (view_->GetWidget()->widget_delegate()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 255 |
272 last_target_update_time_ = now; | 256 last_target_update_time_ = now; |
273 } | 257 } |
274 | 258 |
275 void SettingLevelBubble::StopAnimation() { | 259 void SettingLevelBubble::StopAnimation() { |
276 animation_timer_.Stop(); | 260 animation_timer_.Stop(); |
277 is_animating_ = false; | 261 is_animating_ = false; |
278 } | 262 } |
279 | 263 |
280 } // namespace chromeos | 264 } // namespace chromeos |
OLD | NEW |