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

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

Issue 271773002: Retain popup bubble mouse status even through updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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 | 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 Layout(); 80 Layout();
81 81
82 // If it has the contents already, this invocation means an update of the 82 // If it has the contents already, this invocation means an update of the
83 // popup toast, and the new contents should be read through a11y feature. 83 // popup toast, and the new contents should be read through a11y feature.
84 // The notification type should be ALERT, otherwise the accessibility message 84 // The notification type should be ALERT, otherwise the accessibility message
85 // won't be read for this view which returns ROLE_WINDOW. 85 // won't be read for this view which returns ROLE_WINDOW.
86 if (already_has_contents && a11y_feedback_for_updates) 86 if (already_has_contents && a11y_feedback_for_updates)
87 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false); 87 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false);
88 } 88 }
89 89
90 void ToastContentsView::UpdateContents(const Notification& notification,
91 bool a11y_feedback_for_updates) {
92 DCHECK_GT(child_count(), 0);
93 MessageView* message_view = static_cast<MessageView*>(child_at(0));
94 message_view->UpdateWithNotification(notification);
95 if (a11y_feedback_for_updates)
96 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, false);
97 }
98
90 void ToastContentsView::RevealWithAnimation(gfx::Point origin) { 99 void ToastContentsView::RevealWithAnimation(gfx::Point origin) {
91 // Place/move the toast widgets. Currently it stacks the widgets from the 100 // Place/move the toast widgets. Currently it stacks the widgets from the
92 // right-bottom of the work area. 101 // right-bottom of the work area.
93 // TODO(mukai): allow to specify the placement policy from outside of this 102 // TODO(mukai): allow to specify the placement policy from outside of this
94 // class. The policy should be specified from preference on Windows, or 103 // class. The policy should be specified from preference on Windows, or
95 // the launcher alignment on ChromeOS. 104 // the launcher alignment on ChromeOS.
96 origin_ = gfx::Point(origin.x() - preferred_size_.width(), 105 origin_ = gfx::Point(origin.x() - preferred_size_.width(),
97 origin.y() - preferred_size_.height()); 106 origin.y() - preferred_size_.height());
98 107
99 gfx::Rect stable_bounds(origin_, preferred_size_); 108 gfx::Rect stable_bounds(origin_, preferred_size_);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 352 }
344 353
345 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { 354 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) {
346 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, 355 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth,
347 bounds.y(), 356 bounds.y(),
348 kClosedToastWidth, 357 kClosedToastWidth,
349 bounds.height()); 358 bounds.height());
350 } 359 }
351 360
352 } // namespace message_center 361 } // 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