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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 13524005: Cleanup: remove NotifyAccessibilityEvent from views::Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #endif 9 #endif
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 gfx::Point screen_point; 307 gfx::Point screen_point;
308 views::View::ConvertPointToScreen(button, &screen_point); 308 views::View::ConvertPointToScreen(button, &screen_point);
309 menu_runner_.reset(new views::MenuRunner(menu_model)); 309 menu_runner_.reset(new views::MenuRunner(menu_model));
310 // Ignore the result since we don't need to handle a deleted menu specially. 310 // Ignore the result since we don't need to handle a deleted menu specially.
311 ignore_result(menu_runner_->RunMenuAt( 311 ignore_result(menu_runner_->RunMenuAt(
312 GetWidget(), button, gfx::Rect(screen_point, button->size()), anchor, 312 GetWidget(), button, gfx::Rect(screen_point, button->size()), anchor,
313 views::MenuRunner::HAS_MNEMONICS)); 313 views::MenuRunner::HAS_MNEMONICS));
314 } 314 }
315 315
316 void InfoBarView::PlatformSpecificShow(bool animate) { 316 void InfoBarView::PlatformSpecificShow(bool animate) {
317 views::Widget* widget = GetWidget();
318 views::FocusManager* focus_manager = GetFocusManager(); 317 views::FocusManager* focus_manager = GetFocusManager();
319 #if defined(OS_WIN) 318 #if defined(OS_WIN)
320 // If we gain focus, we want to restore it to the previously-focused element 319 // If we gain focus, we want to restore it to the previously-focused element
321 // when we're hidden. So when we're in a Widget, create a focus tracker so 320 // when we're hidden. So when we're in a Widget, create a focus tracker so
322 // that if we gain focus we'll know what the previously-focused element was. 321 // that if we gain focus we'll know what the previously-focused element was.
322 views::Widget* widget = GetWidget();
323 if (widget) { 323 if (widget) {
324 focus_tracker_.reset( 324 focus_tracker_.reset(
325 new views::ExternalFocusTracker(this, focus_manager)); 325 new views::ExternalFocusTracker(this, focus_manager));
326 } 326 }
327 #endif 327 #endif
328 if (focus_manager) 328 if (focus_manager)
329 focus_manager->AddFocusChangeListener(this); 329 focus_manager->AddFocusChangeListener(this);
330 if (widget) { 330 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true);
331 widget->NotifyAccessibilityEvent(
332 this, ui::AccessibilityTypes::EVENT_ALERT, true);
333 }
334 } 331 }
335 332
336 void InfoBarView::PlatformSpecificHide(bool animate) { 333 void InfoBarView::PlatformSpecificHide(bool animate) {
337 // Cancel any menus we may have open. It doesn't make sense to leave them 334 // Cancel any menus we may have open. It doesn't make sense to leave them
338 // open while we're hidden, and if we're going to become unowned, we can't 335 // open while we're hidden, and if we're going to become unowned, we can't
339 // allow the user to choose any options and potentially call functions that 336 // allow the user to choose any options and potentially call functions that
340 // try to access the owner. 337 // try to access the owner.
341 menu_runner_.reset(); 338 menu_runner_.reset();
342 339
343 // It's possible to be called twice (once with |animate| true and once with it 340 // It's possible to be called twice (once with |animate| true and once with it
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 373 }
377 374
378 gfx::Size InfoBarView::GetPreferredSize() { 375 gfx::Size InfoBarView::GetPreferredSize() {
379 return gfx::Size(0, total_height()); 376 return gfx::Size(0, total_height());
380 } 377 }
381 378
382 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 379 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
383 // This will trigger some screen readers to read the entire contents of this 380 // This will trigger some screen readers to read the entire contents of this
384 // infobar. 381 // infobar.
385 if (focused_before && focused_now && !Contains(focused_before) && 382 if (focused_before && focused_now && !Contains(focused_before) &&
386 Contains(focused_now) && GetWidget()) { 383 Contains(focused_now)) {
387 GetWidget()->NotifyAccessibilityEvent( 384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true);
388 this, ui::AccessibilityTypes::EVENT_ALERT, true);
389 } 385 }
390 } 386 }
391 387
392 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { 388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) {
393 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698