| 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/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 24 #include "ui/views/controls/button/menu_button.h" | 24 #include "ui/views/controls/button/menu_button.h" |
| 25 #include "ui/views/controls/image_view.h" | 25 #include "ui/views/controls/image_view.h" |
| 26 #include "ui/views/controls/menu/menu_item_view.h" | 26 #include "ui/views/controls/menu/menu_item_view.h" |
| 27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 | 28 |
| 29 | 29 |
| 30 // ExtensionInfoBarDelegate ---------------------------------------------------- | 30 // ExtensionInfoBarDelegate ---------------------------------------------------- |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 scoped_ptr<InfoBar> ExtensionInfoBarDelegate::CreateInfoBar( | 33 scoped_ptr<infobars::InfoBar> ExtensionInfoBarDelegate::CreateInfoBar( |
| 34 scoped_ptr<ExtensionInfoBarDelegate> delegate) { | 34 scoped_ptr<ExtensionInfoBarDelegate> delegate) { |
| 35 Browser* browser = delegate->browser_; | 35 Browser* browser = delegate->browser_; |
| 36 return scoped_ptr<InfoBar>(new ExtensionInfoBar(delegate.Pass(), browser)); | 36 return scoped_ptr<infobars::InfoBar>( |
| 37 new ExtensionInfoBar(delegate.Pass(), browser)); |
| 37 } | 38 } |
| 38 | 39 |
| 39 | 40 |
| 40 // ExtensionInfoBar ------------------------------------------------------------ | 41 // ExtensionInfoBar ------------------------------------------------------------ |
| 41 | 42 |
| 42 namespace { | 43 namespace { |
| 43 // The horizontal margin between the infobar icon and the Extension (HTML) view. | 44 // The horizontal margin between the infobar icon and the Extension (HTML) view. |
| 44 const int kIconHorizontalMargin = 1; | 45 const int kIconHorizontalMargin = 1; |
| 45 | 46 |
| 46 class MenuImageSource: public gfx::CanvasImageSource { | 47 class MenuImageSource: public gfx::CanvasImageSource { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 77 const gfx::ImageSkia drop_image_; | 78 const gfx::ImageSkia drop_image_; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(MenuImageSource); | 80 DISALLOW_COPY_AND_ASSIGN(MenuImageSource); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace | 83 } // namespace |
| 83 | 84 |
| 84 ExtensionInfoBar::ExtensionInfoBar( | 85 ExtensionInfoBar::ExtensionInfoBar( |
| 85 scoped_ptr<ExtensionInfoBarDelegate> delegate, | 86 scoped_ptr<ExtensionInfoBarDelegate> delegate, |
| 86 Browser* browser) | 87 Browser* browser) |
| 87 : InfoBarView(delegate.PassAs<InfoBarDelegate>()), | 88 : InfoBarView(delegate.PassAs<infobars::InfoBarDelegate>()), |
| 88 browser_(browser), | 89 browser_(browser), |
| 89 infobar_icon_(NULL), | 90 infobar_icon_(NULL), |
| 90 icon_as_menu_(NULL), | 91 icon_as_menu_(NULL), |
| 91 icon_as_image_(NULL), | 92 icon_as_image_(NULL), |
| 92 weak_ptr_factory_(this) { | 93 weak_ptr_factory_(this) { |
| 93 } | 94 } |
| 94 | 95 |
| 95 ExtensionInfoBar::~ExtensionInfoBar() { | 96 ExtensionInfoBar::~ExtensionInfoBar() { |
| 96 } | 97 } |
| 97 | 98 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 Layout(); | 220 Layout(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 223 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
| 223 return delegate()->AsExtensionInfoBarDelegate(); | 224 return delegate()->AsExtensionInfoBarDelegate(); |
| 224 } | 225 } |
| 225 | 226 |
| 226 int ExtensionInfoBar::NonExtensionViewWidth() const { | 227 int ExtensionInfoBar::NonExtensionViewWidth() const { |
| 227 return infobar_icon_->width() + kIconHorizontalMargin; | 228 return infobar_icon_->width() + kIconHorizontalMargin; |
| 228 } | 229 } |
| OLD | NEW |