| 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/api/icons/icons_handler.h" | 8 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 9 #include "chrome/common/extensions/extension.h" | |
| 10 #include "ui/base/accessibility/accessible_view_state.h" | 9 #include "ui/base/accessibility/accessible_view_state.h" |
| 11 | 10 |
| 12 using content::WebContents; | 11 using content::WebContents; |
| 13 | 12 |
| 14 PageActionWithBadgeView::PageActionWithBadgeView( | 13 PageActionWithBadgeView::PageActionWithBadgeView( |
| 15 PageActionImageView* image_view) { | 14 PageActionImageView* image_view) { |
| 16 image_view_ = image_view; | 15 image_view_ = image_view; |
| 17 AddChildView(image_view_); | 16 AddChildView(image_view_); |
| 18 TouchableLocationBarView::Init(this); | 17 TouchableLocationBarView::Init(this); |
| 19 } | 18 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 const gfx::ImageSkia& image = image_view()->GetImage(); | 39 const gfx::ImageSkia& image = image_view()->GetImage(); |
| 41 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. |
| 42 image_view_->SetBounds(0, y, width(), height()); | 41 image_view_->SetBounds(0, y, width(), height()); |
| 43 } | 42 } |
| 44 | 43 |
| 45 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents, | 44 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents, |
| 46 const GURL& url) { | 45 const GURL& url) { |
| 47 image_view_->UpdateVisibility(contents, url); | 46 image_view_->UpdateVisibility(contents, url); |
| 48 SetVisible(image_view_->visible()); | 47 SetVisible(image_view_->visible()); |
| 49 } | 48 } |
| OLD | NEW |