| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 void InfoBarView::PlatformSpecificHide(bool animate) { | 312 void InfoBarView::PlatformSpecificHide(bool animate) { |
| 313 // It's possible to be called twice (once with |animate| true and once with it | 313 // It's possible to be called twice (once with |animate| true and once with it |
| 314 // false); in this case the second RemoveFocusChangeListener() call will | 314 // false); in this case the second RemoveFocusChangeListener() call will |
| 315 // silently no-op. | 315 // silently no-op. |
| 316 views::FocusManager* focus_manager = GetFocusManager(); | 316 views::FocusManager* focus_manager = GetFocusManager(); |
| 317 if (focus_manager) | 317 if (focus_manager) |
| 318 focus_manager->RemoveFocusChangeListener(this); | 318 focus_manager->RemoveFocusChangeListener(this); |
| 319 | 319 |
| 320 #if defined(OS_WIN) | 320 #if defined(OS_WIN) && !defined(USE_AURA) |
| 321 if (!animate || !focus_tracker_.get()) | 321 if (!animate || !focus_tracker_.get()) |
| 322 return; | 322 return; |
| 323 | 323 |
| 324 // Do not restore focus (and active state with it) if some other top-level | 324 // Do not restore focus (and active state with it) if some other top-level |
| 325 // window became active. | 325 // window became active. |
| 326 views::Widget* widget = GetWidget(); | 326 views::Widget* widget = GetWidget(); |
| 327 if (!widget || ui::DoesWindowBelongToActiveWindow(widget->GetNativeView())) | 327 if (!widget || ui::DoesWindowBelongToActiveWindow(widget->GetNativeView())) |
| 328 focus_tracker_->FocusLastFocusedExternalView(); | 328 focus_tracker_->FocusLastFocusedExternalView(); |
| 329 focus_tracker_.reset(); | 329 focus_tracker_.reset(); |
| 330 #endif | 330 #endif |
| (...skipping 20 matching lines...) Expand all Loading... |
| 351 | 351 |
| 352 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) { | 352 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) { |
| 353 // This will trigger some screen readers to read the entire contents of this | 353 // This will trigger some screen readers to read the entire contents of this |
| 354 // infobar. | 354 // infobar. |
| 355 if (focused_before && focused_now && !Contains(focused_before) && | 355 if (focused_before && focused_now && !Contains(focused_before) && |
| 356 Contains(focused_now) && GetWidget()) { | 356 Contains(focused_now) && GetWidget()) { |
| 357 GetWidget()->NotifyAccessibilityEvent( | 357 GetWidget()->NotifyAccessibilityEvent( |
| 358 this, ui::AccessibilityTypes::EVENT_ALERT, true); | 358 this, ui::AccessibilityTypes::EVENT_ALERT, true); |
| 359 } | 359 } |
| 360 } | 360 } |
| OLD | NEW |