| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 void ToastContentsView::OnDisplayChanged() { | 239 void ToastContentsView::OnDisplayChanged() { |
| 240 views::Widget* widget = GetWidget(); | 240 views::Widget* widget = GetWidget(); |
| 241 if (!widget) | 241 if (!widget) |
| 242 return; | 242 return; |
| 243 | 243 |
| 244 gfx::NativeView native_view = widget->GetNativeView(); | 244 gfx::NativeView native_view = widget->GetNativeView(); |
| 245 if (!native_view || !collection_.get()) | 245 if (!native_view || !collection_.get()) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 collection_->OnDisplayMetricsChanged( | 248 collection_->OnDisplayMetricsChanged( |
| 249 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view), | 249 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view)); |
| 250 gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS | | |
| 251 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); | |
| 252 } | 250 } |
| 253 | 251 |
| 254 void ToastContentsView::OnWorkAreaChanged() { | 252 void ToastContentsView::OnWorkAreaChanged() { |
| 255 views::Widget* widget = GetWidget(); | 253 views::Widget* widget = GetWidget(); |
| 256 if (!widget) | 254 if (!widget) |
| 257 return; | 255 return; |
| 258 | 256 |
| 259 gfx::NativeView native_view = widget->GetNativeView(); | 257 gfx::NativeView native_view = widget->GetNativeView(); |
| 260 if (!native_view || !collection_.get()) | 258 if (!native_view || !collection_.get()) |
| 261 return; | 259 return; |
| 262 | 260 |
| 263 collection_->OnDisplayMetricsChanged( | 261 collection_->OnDisplayMetricsChanged( |
| 264 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view), | 262 Screen::GetScreenFor(native_view)->GetDisplayNearestWindow(native_view)); |
| 265 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); | |
| 266 } | 263 } |
| 267 | 264 |
| 268 // views::View | 265 // views::View |
| 269 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { | 266 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { |
| 270 if (collection_) | 267 if (collection_) |
| 271 collection_->OnMouseEntered(this); | 268 collection_->OnMouseEntered(this); |
| 272 } | 269 } |
| 273 | 270 |
| 274 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { | 271 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { |
| 275 if (collection_) | 272 if (collection_) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 348 } |
| 352 | 349 |
| 353 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 350 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
| 354 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 351 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
| 355 bounds.y(), | 352 bounds.y(), |
| 356 kClosedToastWidth, | 353 kClosedToastWidth, |
| 357 bounds.height()); | 354 bounds.height()); |
| 358 } | 355 } |
| 359 | 356 |
| 360 } // namespace message_center | 357 } // namespace message_center |
| OLD | NEW |