Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: ui/message_center/views/toast_contents_view.cc

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: test GetDisplayNearestView Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void ToastContentsView::OnDisplayChanged() { 246 void ToastContentsView::OnDisplayChanged() {
247 views::Widget* widget = GetWidget(); 247 views::Widget* widget = GetWidget();
248 if (!widget) 248 if (!widget)
249 return; 249 return;
250 250
251 gfx::NativeView native_view = widget->GetNativeView(); 251 gfx::NativeView native_view = widget->GetNativeView();
252 if (!native_view || !collection_.get()) 252 if (!native_view || !collection_.get())
253 return; 253 return;
254 254
255 collection_->OnDisplayMetricsChanged( 255 collection_->OnDisplayMetricsChanged(
256 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); 256 Screen::GetScreen()->GetDisplayNearestView(native_view));
257 } 257 }
258 258
259 void ToastContentsView::OnWorkAreaChanged() { 259 void ToastContentsView::OnWorkAreaChanged() {
260 views::Widget* widget = GetWidget(); 260 views::Widget* widget = GetWidget();
261 if (!widget) 261 if (!widget)
262 return; 262 return;
263 263
264 gfx::NativeView native_view = widget->GetNativeView(); 264 gfx::NativeView native_view = widget->GetNativeView();
265 if (!native_view || !collection_.get()) 265 if (!native_view || !collection_.get())
266 return; 266 return;
267 267
268 collection_->OnDisplayMetricsChanged( 268 collection_->OnDisplayMetricsChanged(
269 Screen::GetScreen()->GetDisplayNearestWindow(native_view)); 269 Screen::GetScreen()->GetDisplayNearestView(native_view));
270 } 270 }
271 271
272 // views::View 272 // views::View
273 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { 273 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) {
274 if (collection_) 274 if (collection_)
275 collection_->OnMouseEntered(this); 275 collection_->OnMouseEntered(this);
276 } 276 }
277 277
278 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { 278 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) {
279 if (collection_) 279 if (collection_)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 390
391 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { 391 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) {
392 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, 392 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth,
393 bounds.y(), 393 bounds.y(),
394 kClosedToastWidth, 394 kClosedToastWidth,
395 bounds.height()); 395 bounds.height());
396 } 396 }
397 397
398 } // namespace message_center 398 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698