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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 | 231 |
232 void ToastContentsView::OnDisplayChanged() { | 232 void ToastContentsView::OnDisplayChanged() { |
233 views::Widget* widget = GetWidget(); | 233 views::Widget* widget = GetWidget(); |
234 if (!widget) | 234 if (!widget) |
235 return; | 235 return; |
236 | 236 |
237 gfx::NativeView native_view = widget->GetNativeView(); | 237 gfx::NativeView native_view = widget->GetNativeView(); |
238 if (!native_view || !collection_.get()) | 238 if (!native_view || !collection_.get()) |
239 return; | 239 return; |
240 | 240 |
241 collection_->OnDisplayBoundsChanged(gfx::Screen::GetScreenFor( | 241 int metrics = gfx::DisplayObserver::DISPLAY_METRICS_BOUNDS | |
oshima
2014/05/08 18:06:50
const
mlamouri (slow - plz ping)
2014/05/09 16:11:39
Done.
mlamouri (slow - plz ping)
2014/05/09 16:11:39
Done.
| |
242 native_view)->GetDisplayNearestWindow(native_view)); | 242 gfx::DisplayObserver::DISPLAY_METRICS_WORKAREA; |
243 collection_->OnDisplayMetricsChanged(gfx::Screen::GetScreenFor( | |
244 native_view)->GetDisplayNearestWindow(native_view), | |
245 static_cast<gfx::DisplayObserver::MetricsType>(metrics)); | |
243 } | 246 } |
244 | 247 |
245 void ToastContentsView::OnWorkAreaChanged() { | 248 void ToastContentsView::OnWorkAreaChanged() { |
246 views::Widget* widget = GetWidget(); | 249 views::Widget* widget = GetWidget(); |
247 if (!widget) | 250 if (!widget) |
248 return; | 251 return; |
249 | 252 |
250 gfx::NativeView native_view = widget->GetNativeView(); | 253 gfx::NativeView native_view = widget->GetNativeView(); |
251 if (!native_view || !collection_.get()) | 254 if (!native_view || !collection_.get()) |
252 return; | 255 return; |
253 | 256 |
254 collection_->OnDisplayBoundsChanged(gfx::Screen::GetScreenFor( | 257 collection_->OnDisplayMetricsChanged(gfx::Screen::GetScreenFor( |
255 native_view)->GetDisplayNearestWindow(native_view)); | 258 native_view)->GetDisplayNearestWindow(native_view), |
259 gfx::DisplayObserver::DISPLAY_METRICS_WORKAREA); | |
256 } | 260 } |
257 | 261 |
258 // views::View | 262 // views::View |
259 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { | 263 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { |
260 if (collection_) | 264 if (collection_) |
261 collection_->OnMouseEntered(this); | 265 collection_->OnMouseEntered(this); |
262 } | 266 } |
263 | 267 |
264 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { | 268 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { |
265 if (collection_) | 269 if (collection_) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 } | 347 } |
344 | 348 |
345 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 349 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
346 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 350 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
347 bounds.y(), | 351 bounds.y(), |
348 kClosedToastWidth, | 352 kClosedToastWidth, |
349 bounds.height()); | 353 bounds.height()); |
350 } | 354 } |
351 | 355 |
352 } // namespace message_center | 356 } // namespace message_center |
OLD | NEW |