| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 void ToastContentsView::OnDisplayChanged() { | 243 void ToastContentsView::OnDisplayChanged() { |
| 244 views::Widget* widget = GetWidget(); | 244 views::Widget* widget = GetWidget(); |
| 245 if (!widget) | 245 if (!widget) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 gfx::NativeView native_view = widget->GetNativeView(); | 248 gfx::NativeView native_view = widget->GetNativeView(); |
| 249 if (!native_view || !collection_.get()) | 249 if (!native_view || !collection_.get()) |
| 250 return; | 250 return; |
| 251 | 251 |
| 252 collection_->OnDisplayMetricsChanged( | 252 collection_->OnDisplayMetricsChanged( |
| 253 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view)); | 253 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void ToastContentsView::OnWorkAreaChanged() { | 256 void ToastContentsView::OnWorkAreaChanged() { |
| 257 views::Widget* widget = GetWidget(); | 257 views::Widget* widget = GetWidget(); |
| 258 if (!widget) | 258 if (!widget) |
| 259 return; | 259 return; |
| 260 | 260 |
| 261 gfx::NativeView native_view = widget->GetNativeView(); | 261 gfx::NativeView native_view = widget->GetNativeView(); |
| 262 if (!native_view || !collection_.get()) | 262 if (!native_view || !collection_.get()) |
| 263 return; | 263 return; |
| 264 | 264 |
| 265 collection_->OnDisplayMetricsChanged( | 265 collection_->OnDisplayMetricsChanged( |
| 266 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view)); | 266 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 // views::View | 269 // views::View |
| 270 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { | 270 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { |
| 271 if (collection_) | 271 if (collection_) |
| 272 collection_->OnMouseEntered(this); | 272 collection_->OnMouseEntered(this); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { | 275 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { |
| 276 if (collection_) | 276 if (collection_) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 358 } |
| 359 | 359 |
| 360 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 360 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
| 361 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 361 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
| 362 bounds.y(), | 362 bounds.y(), |
| 363 kClosedToastWidth, | 363 kClosedToastWidth, |
| 364 bounds.height()); | 364 bounds.height()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace message_center | 367 } // namespace message_center |
| OLD | NEW |