| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 gfx::Rect monitor_area = | 131 gfx::Rect monitor_area = |
| 132 gfx::Screen::GetMonitorAreaNearestWindow( | 132 gfx::Screen::GetMonitorAreaNearestWindow( |
| 133 parent_->GetNativeView()); | 133 parent_->GetNativeView()); |
| 134 return (gfx::Point( | 134 return (gfx::Point( |
| 135 monitor_area.x() + kBubbleXRatio * monitor_area.width(), | 135 monitor_area.x() + kBubbleXRatio * monitor_area.width(), |
| 136 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap)); | 136 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView( | 139 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView( |
| 140 views::Widget* parent) | 140 views::Widget* parent) |
| 141 : BubbleDelegateView(gfx::Point(), | 141 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT, SK_ColorWHITE), |
| 142 views::BubbleBorder::FLOAT, | |
| 143 SK_ColorWHITE), | |
| 144 parent_(parent), | 142 parent_(parent), |
| 145 view_(NULL) { | 143 view_(NULL) { |
| 146 set_close_on_esc(false); | 144 set_close_on_esc(false); |
| 147 set_use_focusless(true); | 145 set_use_focusless(true); |
| 148 } | 146 } |
| 149 | 147 |
| 150 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { | 148 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { |
| 151 view_ = NULL; | 149 view_ = NULL; |
| 152 } | 150 } |
| 153 | 151 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 last_animation_update_time_ = TimeTicks(); | 229 last_animation_update_time_ = TimeTicks(); |
| 232 last_target_update_time_ = TimeTicks(); | 230 last_target_update_time_ = TimeTicks(); |
| 233 hide_timer_.Stop(); | 231 hide_timer_.Stop(); |
| 234 StopAnimation(); | 232 StopAnimation(); |
| 235 } | 233 } |
| 236 | 234 |
| 237 SettingLevelBubbleView* SettingLevelBubble::CreateView() { | 235 SettingLevelBubbleView* SettingLevelBubble::CreateView() { |
| 238 views::Widget* parent = GetToplevelWidget(); | 236 views::Widget* parent = GetToplevelWidget(); |
| 239 SettingLevelBubbleDelegateView* delegate = | 237 SettingLevelBubbleDelegateView* delegate = |
| 240 new SettingLevelBubbleDelegateView(parent); | 238 new SettingLevelBubbleDelegateView(parent); |
| 241 views::Widget* widget = | 239 views::Widget* widget = views::BubbleDelegateView::CreateBubble(delegate); |
| 242 views::BubbleDelegateView::CreateBubble(delegate, parent); | |
| 243 widget->AddObserver(this); | 240 widget->AddObserver(this); |
| 244 | 241 |
| 245 #if !defined(USE_AURA) | 242 #if !defined(USE_AURA) |
| 246 { | 243 { |
| 247 // TODO(alicet): Move this code to bubble_delegate_view.cc | 244 // TODO(alicet): Move this code to bubble_delegate_view.cc |
| 248 // and add description on what this code does. | 245 // and add description on what this code does. |
| 249 std::vector<int> params; | 246 std::vector<int> params; |
| 250 params.push_back(1); // show_while_screen_is_locked_ | 247 params.push_back(1); // show_while_screen_is_locked_ |
| 251 chromeos::WmIpc::instance()->SetWindowType( | 248 chromeos::WmIpc::instance()->SetWindowType( |
| 252 widget->GetNativeView(), | 249 widget->GetNativeView(), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 321 |
| 325 last_target_update_time_ = now; | 322 last_target_update_time_ = now; |
| 326 } | 323 } |
| 327 | 324 |
| 328 void SettingLevelBubble::StopAnimation() { | 325 void SettingLevelBubble::StopAnimation() { |
| 329 animation_timer_.Stop(); | 326 animation_timer_.Stop(); |
| 330 is_animating_ = false; | 327 is_animating_ = false; |
| 331 } | 328 } |
| 332 | 329 |
| 333 } // namespace chromeos | 330 } // namespace chromeos |
| OLD | NEW |