| 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/location_bar/page_action_with_badge_view.h" | 5 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_action.h" | 7 #include "chrome/browser/extensions/extension_action.h" |
| 8 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 8 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 9 #include "ui/accessibility/ax_enums.h" |
| 9 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| 10 #include "ui/views/layout/fill_layout.h" | 11 #include "ui/views/layout/fill_layout.h" |
| 11 | 12 |
| 12 PageActionWithBadgeView::PageActionWithBadgeView( | 13 PageActionWithBadgeView::PageActionWithBadgeView( |
| 13 PageActionImageView* image_view) : image_view_(image_view) { | 14 PageActionImageView* image_view) : image_view_(image_view) { |
| 14 AddChildView(image_view_); | 15 AddChildView(image_view_); |
| 15 SetLayoutManager(new views::FillLayout()); | 16 SetLayoutManager(new views::FillLayout()); |
| 16 } | 17 } |
| 17 | 18 |
| 18 void PageActionWithBadgeView::GetAccessibleState( | 19 void PageActionWithBadgeView::GetAccessibleState( |
| 19 ui::AXViewState* state) { | 20 ui::AXViewState* state) { |
| 20 state->role = ui::AX_ROLE_GROUP; | 21 state->role = ui::AX_ROLE_GROUP; |
| 21 } | 22 } |
| 22 | 23 |
| 23 gfx::Size PageActionWithBadgeView::GetPreferredSize() const { | 24 gfx::Size PageActionWithBadgeView::GetPreferredSize() const { |
| 24 return gfx::Size(ExtensionAction::ActionIconSize(), | 25 return gfx::Size(ExtensionAction::ActionIconSize(), |
| 25 ExtensionAction::ActionIconSize()); | 26 ExtensionAction::ActionIconSize()); |
| 26 } | 27 } |
| 27 | 28 |
| 28 void PageActionWithBadgeView::UpdateVisibility(content::WebContents* contents) { | 29 void PageActionWithBadgeView::UpdateVisibility(content::WebContents* contents) { |
| 29 image_view_->UpdateVisibility(contents); | 30 image_view_->UpdateVisibility(contents); |
| 30 SetVisible(image_view_->visible()); | 31 SetVisible(image_view_->visible()); |
| 31 } | 32 } |
| 32 | 33 |
| 33 const char* PageActionWithBadgeView::GetClassName() const { | 34 const char* PageActionWithBadgeView::GetClassName() const { |
| 34 return "PageActionWithBadgeView"; | 35 return "PageActionWithBadgeView"; |
| 35 } | 36 } |
| OLD | NEW |