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

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

Issue 53503004: Restore focus when infobar closes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
« 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) 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // Cancel any menus we may have open. It doesn't make sense to leave them 326 // Cancel any menus we may have open. It doesn't make sense to leave them
327 // open while we're hidden, and if we're going to become unowned, we can't 327 // open while we're hidden, and if we're going to become unowned, we can't
328 // allow the user to choose any options and potentially call functions that 328 // allow the user to choose any options and potentially call functions that
329 // try to access the owner. 329 // try to access the owner.
330 menu_runner_.reset(); 330 menu_runner_.reset();
331 331
332 // It's possible to be called twice (once with |animate| true and once with it 332 // It's possible to be called twice (once with |animate| true and once with it
333 // false); in this case the second SetFocusManager() call will silently no-op. 333 // false); in this case the second SetFocusManager() call will silently no-op.
334 SetFocusManager(NULL); 334 SetFocusManager(NULL);
335 335
336 #if defined(OS_WIN) && !defined(USE_AURA)
337 if (!animate) 336 if (!animate)
338 return; 337 return;
339 338
340 // Do not restore focus (and active state with it) if some other top-level 339 // Do not restore focus (and active state with it) if some other top-level
341 // window became active. 340 // window became active.
342 views::Widget* widget = GetWidget(); 341 views::Widget* widget = GetWidget();
343 if (!widget || gfx::DoesWindowBelongToActiveWindow(widget->GetNativeView())) 342 if (!widget || widget->IsActive())
344 FocusLastFocusedExternalView(); 343 FocusLastFocusedExternalView();
345 #endif
346 } 344 }
347 345
348 void InfoBarView::PlatformSpecificOnHeightsRecalculated() { 346 void InfoBarView::PlatformSpecificOnHeightsRecalculated() {
349 // Ensure that notifying our container of our size change will result in a 347 // Ensure that notifying our container of our size change will result in a
350 // re-layout. 348 // re-layout.
351 InvalidateLayout(); 349 InvalidateLayout();
352 } 350 }
353 351
354 void InfoBarView::GetAccessibleState(ui::AccessibleViewState* state) { 352 void InfoBarView::GetAccessibleState(ui::AccessibleViewState* state) {
355 if (delegate()) { 353 if (delegate()) {
(...skipping 11 matching lines...) Expand all
367 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 365 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
368 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); 366 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
369 367
370 // This will trigger some screen readers to read the entire contents of this 368 // This will trigger some screen readers to read the entire contents of this
371 // infobar. 369 // infobar.
372 if (focused_before && focused_now && !Contains(focused_before) && 370 if (focused_before && focused_now && !Contains(focused_before) &&
373 Contains(focused_now)) { 371 Contains(focused_now)) {
374 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); 372 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true);
375 } 373 }
376 } 374 }
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