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