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

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

Issue 259253002: Add OnDisplayMetricsChanged in DisplayObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_orientation
Patch Set: review comments + device scale factor Created 6 years, 7 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 "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
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 const int metrics = gfx::DisplayObserver::DISPLAY_METRICS_BOUNDS |
242 native_view)->GetDisplayNearestWindow(native_view)); 242 gfx::DisplayObserver::DISPLAY_METRICS_WORK_AREA;
243 collection_->OnDisplayMetricsChanged(gfx::Screen::GetScreenFor(
244 native_view)->GetDisplayNearestWindow(native_view),
245 static_cast<gfx::DisplayObserver::DisplayMetrics>(metrics));
stevenjb 2014/05/09 18:51:33 nit: alignment of this is confusing, maybe add a b
mlamouri (slow - plz ping) 2014/05/12 09:20:16 Sadly, doing that was creating a 83 characters lin
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_WORK_AREA);
stevenjb 2014/05/09 18:51:33 ditto
mlamouri (slow - plz ping) 2014/05/12 09:20:16 Done.
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
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
OLDNEW
« no previous file with comments | « ui/message_center/views/message_popup_collection.cc ('k') | ui/views/widget/desktop_aura/desktop_screen_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698