Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc

Issue 1492073003: Handle more scale factors for extension Browser Action icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better docs Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_view_state.h" 9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/views/layout/fill_layout.h" 10 #include "ui/views/layout/fill_layout.h"
11 11
12 PageActionWithBadgeView::PageActionWithBadgeView( 12 PageActionWithBadgeView::PageActionWithBadgeView(
13 PageActionImageView* image_view) : image_view_(image_view) { 13 PageActionImageView* image_view) : image_view_(image_view) {
14 AddChildView(image_view_); 14 AddChildView(image_view_);
15 SetLayoutManager(new views::FillLayout()); 15 SetLayoutManager(new views::FillLayout());
16 } 16 }
17 17
18 void PageActionWithBadgeView::GetAccessibleState( 18 void PageActionWithBadgeView::GetAccessibleState(
19 ui::AXViewState* state) { 19 ui::AXViewState* state) {
20 state->role = ui::AX_ROLE_GROUP; 20 state->role = ui::AX_ROLE_GROUP;
21 } 21 }
22 22
23 gfx::Size PageActionWithBadgeView::GetPreferredSize() const { 23 gfx::Size PageActionWithBadgeView::GetPreferredSize() const {
24 return gfx::Size(ExtensionAction::kPageActionIconMaxSize, 24 return gfx::Size(ExtensionAction::ActionIconSize(),
25 ExtensionAction::kPageActionIconMaxSize); 25 ExtensionAction::ActionIconSize());
26 } 26 }
27 27
28 void PageActionWithBadgeView::UpdateVisibility(content::WebContents* contents) { 28 void PageActionWithBadgeView::UpdateVisibility(content::WebContents* contents) {
29 image_view_->UpdateVisibility(contents); 29 image_view_->UpdateVisibility(contents);
30 SetVisible(image_view_->visible()); 30 SetVisible(image_view_->visible());
31 } 31 }
32 32
33 const char* PageActionWithBadgeView::GetClassName() const { 33 const char* PageActionWithBadgeView::GetClassName() const {
34 return "PageActionWithBadgeView"; 34 return "PageActionWithBadgeView";
35 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698