| 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 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 } | 326 } |
| 327 | 327 |
| 328 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate() | 328 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate() |
| 329 const { | 329 const { |
| 330 const infobars::InfoBarContainer* infobar_container = container(); | 330 const infobars::InfoBarContainer* infobar_container = container(); |
| 331 return infobar_container ? infobar_container->delegate() : NULL; | 331 return infobar_container ? infobar_container->delegate() : NULL; |
| 332 } | 332 } |
| 333 | 333 |
| 334 void InfoBarView::RunMenuAt(ui::MenuModel* menu_model, | 334 void InfoBarView::RunMenuAt(ui::MenuModel* menu_model, |
| 335 views::MenuButton* button, | 335 views::MenuButton* button, |
| 336 views::MenuItemView::AnchorPosition anchor) { | 336 views::MenuAnchorPosition anchor) { |
| 337 DCHECK(owner()); // We'd better not open any menus while we're closing. | 337 DCHECK(owner()); // We'd better not open any menus while we're closing. |
| 338 gfx::Point screen_point; | 338 gfx::Point screen_point; |
| 339 views::View::ConvertPointToScreen(button, &screen_point); | 339 views::View::ConvertPointToScreen(button, &screen_point); |
| 340 menu_runner_.reset(new views::MenuRunner(menu_model)); | 340 menu_runner_.reset(new views::MenuRunner(menu_model)); |
| 341 // Ignore the result since we don't need to handle a deleted menu specially. | 341 // Ignore the result since we don't need to handle a deleted menu specially. |
| 342 ignore_result(menu_runner_->RunMenuAt( | 342 ignore_result(menu_runner_->RunMenuAt( |
| 343 GetWidget(), button, gfx::Rect(screen_point, button->size()), anchor, | 343 GetWidget(), button, gfx::Rect(screen_point, button->size()), anchor, |
| 344 ui::MENU_SOURCE_NONE, views::MenuRunner::HAS_MNEMONICS)); | 344 ui::MENU_SOURCE_NONE, views::MenuRunner::HAS_MNEMONICS)); |
| 345 } | 345 } |
| 346 | 346 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { | 412 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { |
| 413 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); | 413 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); |
| 414 | 414 |
| 415 // This will trigger some screen readers to read the entire contents of this | 415 // This will trigger some screen readers to read the entire contents of this |
| 416 // infobar. | 416 // infobar. |
| 417 if (focused_before && focused_now && !Contains(focused_before) && | 417 if (focused_before && focused_now && !Contains(focused_before) && |
| 418 Contains(focused_now)) { | 418 Contains(focused_now)) { |
| 419 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 419 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 420 } | 420 } |
| 421 } | 421 } |
| OLD | NEW |