OLD | NEW |
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void InfoBarView::RunMenuAt(ui::MenuModel* menu_model, | 303 void InfoBarView::RunMenuAt(ui::MenuModel* menu_model, |
304 views::MenuButton* button, | 304 views::MenuButton* button, |
305 views::MenuItemView::AnchorPosition anchor) { | 305 views::MenuItemView::AnchorPosition anchor) { |
306 DCHECK(owner()); // We'd better not open any menus while we're closing. | 306 DCHECK(owner()); // We'd better not open any menus while we're closing. |
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 ui::MENU_SOURCE_NONE, views::MenuRunner::HAS_MNEMONICS)); |
314 } | 314 } |
315 | 315 |
316 void InfoBarView::PlatformSpecificShow(bool animate) { | 316 void InfoBarView::PlatformSpecificShow(bool animate) { |
317 // If we gain focus, we want to restore it to the previously-focused element | 317 // If we gain focus, we want to restore it to the previously-focused element |
318 // when we're hidden. So when we're in a Widget, create a focus tracker so | 318 // when we're hidden. So when we're in a Widget, create a focus tracker so |
319 // that if we gain focus we'll know what the previously-focused element was. | 319 // that if we gain focus we'll know what the previously-focused element was. |
320 SetFocusManager(GetFocusManager()); | 320 SetFocusManager(GetFocusManager()); |
321 | 321 |
322 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); | 322 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); |
323 } | 323 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { | 367 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { |
368 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); | 368 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); |
369 | 369 |
370 // This will trigger some screen readers to read the entire contents of this | 370 // This will trigger some screen readers to read the entire contents of this |
371 // infobar. | 371 // infobar. |
372 if (focused_before && focused_now && !Contains(focused_before) && | 372 if (focused_before && focused_now && !Contains(focused_before) && |
373 Contains(focused_now)) { | 373 Contains(focused_now)) { |
374 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); | 374 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); |
375 } | 375 } |
376 } | 376 } |
OLD | NEW |