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 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // re-layout. | 273 // re-layout. |
274 InvalidateLayout(); | 274 InvalidateLayout(); |
275 } | 275 } |
276 | 276 |
277 void InfoBarView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 277 void InfoBarView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
278 node_data->SetName(l10n_util::GetStringUTF8( | 278 node_data->SetName(l10n_util::GetStringUTF8( |
279 (delegate()->GetInfoBarType() == infobars::InfoBarDelegate::WARNING_TYPE) | 279 (delegate()->GetInfoBarType() == infobars::InfoBarDelegate::WARNING_TYPE) |
280 ? IDS_ACCNAME_INFOBAR_WARNING | 280 ? IDS_ACCNAME_INFOBAR_WARNING |
281 : IDS_ACCNAME_INFOBAR_PAGE_ACTION)); | 281 : IDS_ACCNAME_INFOBAR_PAGE_ACTION)); |
282 node_data->role = ui::AX_ROLE_ALERT; | 282 node_data->role = ui::AX_ROLE_ALERT; |
283 node_data->AddStringAttribute(ui::AX_ATTR_SHORTCUT, "Alt+Shift+A"); | 283 node_data->AddStringAttribute(ui::AX_ATTR_KEY_SHORTCUTS, "Alt+Shift+A"); |
284 } | 284 } |
285 | 285 |
286 gfx::Size InfoBarView::CalculatePreferredSize() const { | 286 gfx::Size InfoBarView::CalculatePreferredSize() const { |
287 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); | 287 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); |
288 | 288 |
289 const int related_control_spacing = layout_provider->GetDistanceMetric( | 289 const int related_control_spacing = layout_provider->GetDistanceMetric( |
290 views::DISTANCE_RELATED_CONTROL_HORIZONTAL); | 290 views::DISTANCE_RELATED_CONTROL_HORIZONTAL); |
291 const int unrelated_control_spacing = | 291 const int unrelated_control_spacing = |
292 layout_provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL); | 292 layout_provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL); |
293 | 293 |
(...skipping 17 matching lines...) Expand all Loading... |
311 } | 311 } |
312 | 312 |
313 bool InfoBarView::DoesIntersectRect(const View* target, | 313 bool InfoBarView::DoesIntersectRect(const View* target, |
314 const gfx::Rect& rect) const { | 314 const gfx::Rect& rect) const { |
315 DCHECK_EQ(this, target); | 315 DCHECK_EQ(this, target); |
316 // Only events that intersect the portion below the arrow are interesting. | 316 // Only events that intersect the portion below the arrow are interesting. |
317 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 317 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
318 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 318 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
319 return rect.Intersects(non_arrow_bounds); | 319 return rect.Intersects(non_arrow_bounds); |
320 } | 320 } |
OLD | NEW |