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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 void ToastContentsView::OnDisplayChanged() { | 255 void ToastContentsView::OnDisplayChanged() { |
256 views::Widget* widget = GetWidget(); | 256 views::Widget* widget = GetWidget(); |
257 if (!widget) | 257 if (!widget) |
258 return; | 258 return; |
259 | 259 |
260 gfx::NativeView native_view = widget->GetNativeView(); | 260 gfx::NativeView native_view = widget->GetNativeView(); |
261 if (!native_view || !collection_.get()) | 261 if (!native_view || !collection_.get()) |
262 return; | 262 return; |
263 | 263 |
264 collection_->OnDisplayMetricsChanged( | 264 collection_->OnDisplayMetricsChanged( |
265 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); | 265 Screen::GetScreen()->GetDisplayNearestView(native_view)); |
266 } | 266 } |
267 | 267 |
268 void ToastContentsView::OnWorkAreaChanged() { | 268 void ToastContentsView::OnWorkAreaChanged() { |
269 views::Widget* widget = GetWidget(); | 269 views::Widget* widget = GetWidget(); |
270 if (!widget) | 270 if (!widget) |
271 return; | 271 return; |
272 | 272 |
273 gfx::NativeView native_view = widget->GetNativeView(); | 273 gfx::NativeView native_view = widget->GetNativeView(); |
274 if (!native_view || !collection_.get()) | 274 if (!native_view || !collection_.get()) |
275 return; | 275 return; |
276 | 276 |
277 collection_->OnDisplayMetricsChanged( | 277 collection_->OnDisplayMetricsChanged( |
278 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); | 278 Screen::GetScreen()->GetDisplayNearestView(native_view)); |
279 } | 279 } |
280 | 280 |
281 // views::View | 281 // views::View |
282 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { | 282 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { |
283 if (collection_) | 283 if (collection_) |
284 collection_->OnMouseEntered(this); | 284 collection_->OnMouseEntered(this); |
285 } | 285 } |
286 | 286 |
287 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { | 287 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { |
288 if (collection_) | 288 if (collection_) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 402 } |
403 | 403 |
404 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 404 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
405 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 405 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
406 bounds.y(), | 406 bounds.y(), |
407 kClosedToastWidth, | 407 kClosedToastWidth, |
408 bounds.height()); | 408 bounds.height()); |
409 } | 409 } |
410 | 410 |
411 } // namespace message_center | 411 } // namespace message_center |
OLD | NEW |