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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // canvas->sk_canvas()->clipPath(fill_path_); | 263 // canvas->sk_canvas()->clipPath(fill_path_); |
264 DCHECK_EQ(total_height(), height()) | 264 DCHECK_EQ(total_height(), height()) |
265 << "Infobar piecewise heights do not match overall height"; | 265 << "Infobar piecewise heights do not match overall height"; |
266 canvas->ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height())); | 266 canvas->ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height())); |
267 views::View::PaintChildren(canvas); | 267 views::View::PaintChildren(canvas); |
268 canvas->Restore(); | 268 canvas->Restore(); |
269 } | 269 } |
270 | 270 |
271 void InfoBarView::ButtonPressed(views::Button* sender, | 271 void InfoBarView::ButtonPressed(views::Button* sender, |
272 const ui::Event& event) { | 272 const ui::Event& event) { |
273 if (!owned()) | 273 if (!owner()) |
274 return; // We're closing; don't call anything, it might access the owner. | 274 return; // We're closing; don't call anything, it might access the owner. |
275 if (sender == close_button_) { | 275 if (sender == close_button_) { |
276 delegate()->InfoBarDismissed(); | 276 delegate()->InfoBarDismissed(); |
277 RemoveSelf(); | 277 RemoveSelf(); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 int InfoBarView::ContentMinimumWidth() const { | 281 int InfoBarView::ContentMinimumWidth() const { |
282 return 0; | 282 return 0; |
283 } | 283 } |
(...skipping 12 matching lines...) Expand all Loading... |
296 } | 296 } |
297 | 297 |
298 const InfoBarContainer::Delegate* InfoBarView::container_delegate() const { | 298 const InfoBarContainer::Delegate* InfoBarView::container_delegate() const { |
299 const InfoBarContainer* infobar_container = container(); | 299 const InfoBarContainer* infobar_container = container(); |
300 return infobar_container ? infobar_container->delegate() : NULL; | 300 return infobar_container ? infobar_container->delegate() : NULL; |
301 } | 301 } |
302 | 302 |
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(owned()); // 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 views::MenuRunner::HAS_MNEMONICS)); |
314 } | 314 } |
315 | 315 |
316 void InfoBarView::PlatformSpecificShow(bool animate) { | 316 void InfoBarView::PlatformSpecificShow(bool animate) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // 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 |
381 // infobar. | 381 // infobar. |
382 if (focused_before && focused_now && !Contains(focused_before) && | 382 if (focused_before && focused_now && !Contains(focused_before) && |
383 Contains(focused_now)) { | 383 Contains(focused_now)) { |
384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); | 384 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { | 388 void InfoBarView::OnDidChangeFocus(View* focused_before, View* focused_now) { |
389 } | 389 } |
OLD | NEW |