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/infobars/extension_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_context_menu_model.h" | 7 #include "chrome/browser/extensions/extension_context_menu_model.h" |
8 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 8 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
9 #include "chrome/browser/extensions/extension_view_host.h" | 9 #include "chrome/browser/extensions/extension_view_host.h" |
10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 const int kIconHorizontalMargin = 1; | 45 const int kIconHorizontalMargin = 1; |
46 | 46 |
47 class MenuImageSource: public gfx::CanvasImageSource { | 47 class MenuImageSource: public gfx::CanvasImageSource { |
48 public: | 48 public: |
49 MenuImageSource(const gfx::ImageSkia& icon, const gfx::ImageSkia& drop_image) | 49 MenuImageSource(const gfx::ImageSkia& icon, const gfx::ImageSkia& drop_image) |
50 : gfx::CanvasImageSource(ComputeSize(drop_image), false), | 50 : gfx::CanvasImageSource(ComputeSize(drop_image), false), |
51 icon_(icon), | 51 icon_(icon), |
52 drop_image_(drop_image) { | 52 drop_image_(drop_image) { |
53 } | 53 } |
54 | 54 |
55 virtual ~MenuImageSource() { | 55 ~MenuImageSource() override {} |
56 } | |
57 | 56 |
58 // Overridden from gfx::CanvasImageSource | 57 // Overridden from gfx::CanvasImageSource |
59 virtual void Draw(gfx::Canvas* canvas) override { | 58 void Draw(gfx::Canvas* canvas) override { |
60 int image_size = extension_misc::EXTENSION_ICON_BITTY; | 59 int image_size = extension_misc::EXTENSION_ICON_BITTY; |
61 canvas->DrawImageInt(icon_, 0, 0, icon_.width(), icon_.height(), 0, 0, | 60 canvas->DrawImageInt(icon_, 0, 0, icon_.width(), icon_.height(), 0, 0, |
62 image_size, image_size, false); | 61 image_size, image_size, false); |
63 canvas->DrawImageInt(drop_image_, image_size + kDropArrowLeftMargin, | 62 canvas->DrawImageInt(drop_image_, image_size + kDropArrowLeftMargin, |
64 image_size / 2); | 63 image_size / 2); |
65 } | 64 } |
66 | 65 |
67 private: | 66 private: |
68 gfx::Size ComputeSize(const gfx::ImageSkia& drop_image) const { | 67 gfx::Size ComputeSize(const gfx::ImageSkia& drop_image) const { |
69 int image_size = extension_misc::EXTENSION_ICON_BITTY; | 68 int image_size = extension_misc::EXTENSION_ICON_BITTY; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 226 } |
228 | 227 |
229 ExtensionViewViews* ExtensionInfoBar::GetExtensionView() { | 228 ExtensionViewViews* ExtensionInfoBar::GetExtensionView() { |
230 return static_cast<ExtensionViewViews*>( | 229 return static_cast<ExtensionViewViews*>( |
231 GetDelegate()->extension_view_host()->view()); | 230 GetDelegate()->extension_view_host()->view()); |
232 } | 231 } |
233 | 232 |
234 int ExtensionInfoBar::NonExtensionViewWidth() const { | 233 int ExtensionInfoBar::NonExtensionViewWidth() const { |
235 return infobar_icon_->width() + kIconHorizontalMargin; | 234 return infobar_icon_->width() + kIconHorizontalMargin; |
236 } | 235 } |
OLD | NEW |