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

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

Issue 23764003: Make toasts notice when they're hidden and send the mouse-out event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/message_center/views/toast_contents_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 OnBoundsAnimationEndedOrCancelled(animation); 241 OnBoundsAnimationEndedOrCancelled(animation);
242 } 242 }
243 243
244 // views::WidgetDelegate 244 // views::WidgetDelegate
245 views::View* ToastContentsView::GetContentsView() { 245 views::View* ToastContentsView::GetContentsView() {
246 return this; 246 return this;
247 } 247 }
248 248
249 void ToastContentsView::WindowClosing() { 249 void ToastContentsView::WindowClosing() {
250 if (!is_closing_ && collection_) 250 if (!is_closing_ && collection_)
251 collection_->RemoveToast(this); 251 collection_->RemoveToast(this);
sadrul 2013/08/30 17:18:31 I think it makes more sense for RemoveToast() to r
dewittj 2013/08/30 17:29:24 Done.
252 } 252 }
253 253
254 bool ToastContentsView::CanActivate() const { 254 bool ToastContentsView::CanActivate() const {
255 #if defined(OS_WIN) && defined(USE_AURA) 255 #if defined(OS_WIN) && defined(USE_AURA)
256 return true; 256 return true;
257 #else 257 #else
258 return false; 258 return false;
259 #endif 259 #endif
260 } 260 }
261 261
(...skipping 27 matching lines...) Expand all
289 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) { 289 void ToastContentsView::OnMouseEntered(const ui::MouseEvent& event) {
290 if (collection_) 290 if (collection_)
291 collection_->OnMouseEntered(this); 291 collection_->OnMouseEntered(this);
292 } 292 }
293 293
294 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) { 294 void ToastContentsView::OnMouseExited(const ui::MouseEvent& event) {
295 if (collection_) 295 if (collection_)
296 collection_->OnMouseExited(this); 296 collection_->OnMouseExited(this);
297 } 297 }
298 298
299 void ToastContentsView::VisibilityChanged(
300 View* starting_from, bool is_visible) {
301 if (!is_visible && collection_)
302 collection_->OnMouseExited(this);
303 }
304
299 void ToastContentsView::Layout() { 305 void ToastContentsView::Layout() {
300 if (child_count() > 0) { 306 if (child_count() > 0) {
301 child_at(0)->SetBounds( 307 child_at(0)->SetBounds(
302 0, 0, preferred_size_.width(), preferred_size_.height()); 308 0, 0, preferred_size_.width(), preferred_size_.height());
303 } 309 }
304 } 310 }
305 311
306 gfx::Size ToastContentsView::GetPreferredSize() { 312 gfx::Size ToastContentsView::GetPreferredSize() {
307 return child_count() ? GetToastSizeForView(child_at(0)) : gfx::Size(); 313 return child_count() ? GetToastSizeForView(child_at(0)) : gfx::Size();
308 } 314 }
309 315
310 void ToastContentsView::GetAccessibleState(ui::AccessibleViewState* state) { 316 void ToastContentsView::GetAccessibleState(ui::AccessibleViewState* state) {
311 if (child_count() > 0) 317 if (child_count() > 0)
312 child_at(0)->GetAccessibleState(state); 318 child_at(0)->GetAccessibleState(state);
313 state->role = ui::AccessibilityTypes::ROLE_WINDOW; 319 state->role = ui::AccessibilityTypes::ROLE_WINDOW;
314 } 320 }
315 321
316 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { 322 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) {
317 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, 323 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth,
318 bounds.y(), 324 bounds.y(),
319 kClosedToastWidth, 325 kClosedToastWidth,
320 bounds.height()); 326 bounds.height());
321 } 327 }
322 328
323 } // namespace message_center 329 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/toast_contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698