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

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

Issue 22375008: Let ChromeVox read the toast contents when it's updated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | « no previous file | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 params.top_level = true; 77 params.top_level = true;
78 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 78 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
79 params.delegate = this; 79 params.delegate = this;
80 views::Widget* widget = new views::Widget(); 80 views::Widget* widget = new views::Widget();
81 widget->set_focus_on_creation(false); 81 widget->set_focus_on_creation(false);
82 widget->Init(params); 82 widget->Init(params);
83 return widget; 83 return widget;
84 } 84 }
85 85
86 void ToastContentsView::SetContents(MessageView* view) { 86 void ToastContentsView::SetContents(MessageView* view) {
87 bool already_has_contents = child_count() > 0;
87 RemoveAllChildViews(true); 88 RemoveAllChildViews(true);
88 AddChildView(view); 89 AddChildView(view);
89 preferred_size_ = GetToastSizeForView(view); 90 preferred_size_ = GetToastSizeForView(view);
90 Layout(); 91 Layout();
92 // If it has the contents already, this invocation means an update of the
93 // popup toast, and the new contents should be read through a11y feature.
94 if (already_has_contents)
95 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_FOCUS, false);
91 } 96 }
92 97
93 void ToastContentsView::RevealWithAnimation(gfx::Point origin) { 98 void ToastContentsView::RevealWithAnimation(gfx::Point origin) {
94 // Place/move the toast widgets. Currently it stacks the widgets from the 99 // Place/move the toast widgets. Currently it stacks the widgets from the
95 // right-bottom of the work area. 100 // right-bottom of the work area.
96 // TODO(mukai): allow to specify the placement policy from outside of this 101 // TODO(mukai): allow to specify the placement policy from outside of this
97 // class. The policy should be specified from preference on Windows, or 102 // class. The policy should be specified from preference on Windows, or
98 // the launcher alignment on ChromeOS. 103 // the launcher alignment on ChromeOS.
99 origin_ = gfx::Point(origin.x() - preferred_size_.width(), 104 origin_ = gfx::Point(origin.x() - preferred_size_.width(),
100 origin.y() - preferred_size_.height()); 105 origin.y() - preferred_size_.height());
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 300 }
296 301
297 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { 302 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) {
298 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, 303 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth,
299 bounds.y(), 304 bounds.y(),
300 kClosedToastWidth, 305 kClosedToastWidth,
301 bounds.height()); 306 bounds.height());
302 } 307 }
303 308
304 } // namespace message_center 309 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698