| 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/ui/views/location_bar/page_action_image_view.h" | 7 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "ui/base/accessibility/accessible_view_state.h" | 9 #include "ui/base/accessibility/accessible_view_state.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 int PageActionWithBadgeView::GetBuiltInHorizontalPadding() const { | 30 int PageActionWithBadgeView::GetBuiltInHorizontalPadding() const { |
| 31 return GetBuiltInHorizontalPaddingImpl(); | 31 return GetBuiltInHorizontalPaddingImpl(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void PageActionWithBadgeView::Layout() { | 34 void PageActionWithBadgeView::Layout() { |
| 35 // We have 25 pixels of vertical space in the Omnibox to play with, so even | 35 // We have 25 pixels of vertical space in the Omnibox to play with, so even |
| 36 // sized icons (such as 16x16) have either a 5 or a 4 pixel whitespace | 36 // sized icons (such as 16x16) have either a 5 or a 4 pixel whitespace |
| 37 // (padding) above and below. It looks better to have the extra pixel above | 37 // (padding) above and below. It looks better to have the extra pixel above |
| 38 // the icon than below it, so we add a pixel. http://crbug.com/25708. | 38 // the icon than below it, so we add a pixel. http://crbug.com/25708. |
| 39 const SkBitmap& image = image_view()->GetImage(); | 39 const gfx::ImageSkia& image = image_view()->GetImage(); |
| 40 int y = (image.height() + 1) % 2; // Even numbers: 1px padding. Odd: 0px. | 40 int y = (image.height() + 1) % 2; // Even numbers: 1px padding. Odd: 0px. |
| 41 image_view_->SetBounds(0, y, width(), height()); | 41 image_view_->SetBounds(0, y, width(), height()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents, | 44 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents, |
| 45 const GURL& url) { | 45 const GURL& url) { |
| 46 image_view_->UpdateVisibility(contents, url); | 46 image_view_->UpdateVisibility(contents, url); |
| 47 SetVisible(image_view_->visible()); | 47 SetVisible(image_view_->visible()); |
| 48 } | 48 } |
| OLD | NEW |