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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
7 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/views/layout/fill_layout.h"
12 PageActionWithBadgeView::PageActionWithBadgeView(
13 PageActionImageView
* image_view
) : image_view_(image_view
) {
14 AddChildView(image_view_
);
15 SetLayoutManager(new views::FillLayout());
18 void PageActionWithBadgeView::GetAccessibleState(
19 ui::AXViewState
* state
) {
20 state
->role
= ui::AX_ROLE_GROUP
;
23 gfx::Size
PageActionWithBadgeView::GetPreferredSize() const {
24 return gfx::Size(ExtensionAction::kPageActionIconMaxSize
,
25 ExtensionAction::kPageActionIconMaxSize
);
28 void PageActionWithBadgeView::UpdateVisibility(content::WebContents
* contents
) {
29 image_view_
->UpdateVisibility(contents
);
30 SetVisible(image_view_
->visible());
33 const char* PageActionWithBadgeView::GetClassName() const {
34 return "PageActionWithBadgeView";