| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/message_center/views/toast_contents_view.h" | 5 #include "ui/message_center/views/toast_contents_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 closing_animation_ = (is_closing_ ? fade_animation_.get() : NULL); | 166 closing_animation_ = (is_closing_ ? fade_animation_.get() : NULL); |
| 167 fade_animation_->Reset(1); | 167 fade_animation_->Reset(1); |
| 168 fade_animation_->Hide(); | 168 fade_animation_->Hide(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ToastContentsView::OnBoundsAnimationEndedOrCancelled( | 171 void ToastContentsView::OnBoundsAnimationEndedOrCancelled( |
| 172 const gfx::Animation* animation) { | 172 const gfx::Animation* animation) { |
| 173 if (is_closing_ && closing_animation_ == animation && GetWidget()) { | 173 if (is_closing_ && closing_animation_ == animation && GetWidget()) { |
| 174 views::Widget* widget = GetWidget(); | 174 views::Widget* widget = GetWidget(); |
| 175 #if defined(USE_AURA) | 175 |
| 176 // TODO(dewittj): This is a workaround to prevent a nasty bug where | 176 // TODO(dewittj): This is a workaround to prevent a nasty bug where |
| 177 // closing a transparent widget doesn't actually remove the window, | 177 // closing a transparent widget doesn't actually remove the window, |
| 178 // causing entire areas of the screen to become unresponsive to clicks. | 178 // causing entire areas of the screen to become unresponsive to clicks. |
| 179 // See crbug.com/243469 | 179 // See crbug.com/243469 |
| 180 widget->Hide(); | 180 widget->Hide(); |
| 181 # if defined(OS_WIN) | 181 #if defined(OS_WIN) |
| 182 widget->SetOpacity(0xFF); | 182 widget->SetOpacity(0xFF); |
| 183 # endif | |
| 184 #endif | 183 #endif |
| 184 |
| 185 widget->Close(); | 185 widget->Close(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 // This cannot be called before GetWidget()->Close(). Decrementing defer count | 188 // This cannot be called before GetWidget()->Close(). Decrementing defer count |
| 189 // will invoke update, which may invoke another close animation with | 189 // will invoke update, which may invoke another close animation with |
| 190 // incrementing defer counter. Close() after such process will cause a | 190 // incrementing defer counter. Close() after such process will cause a |
| 191 // mismatch between increment/decrement. See crbug.com/238477 | 191 // mismatch between increment/decrement. See crbug.com/238477 |
| 192 if (collection_) | 192 if (collection_) |
| 193 collection_->DecrementDeferCounter(); | 193 collection_->DecrementDeferCounter(); |
| 194 } | 194 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 | 344 |
| 345 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 345 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
| 346 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 346 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
| 347 bounds.y(), | 347 bounds.y(), |
| 348 kClosedToastWidth, | 348 kClosedToastWidth, |
| 349 bounds.height()); | 349 bounds.height()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace message_center | 352 } // namespace message_center |
| OLD | NEW |