OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/infobars/extension_infobar.h" | 5 #include "chrome/browser/views/infobars/extension_infobar.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
10 #include "chrome/browser/extensions/extension_action_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_action_context_menu_model.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 (height() - sz.height()) / 2, | 82 (height() - sz.height()) / 2, |
83 sz.width(), sz.height()); | 83 sz.width(), sz.height()); |
84 x += sz.width() + kMenuHorizontalMargin; | 84 x += sz.width() + kMenuHorizontalMargin; |
85 | 85 |
86 // Layout the ExtensionView, showing the HTML InfoBar. | 86 // Layout the ExtensionView, showing the HTML InfoBar. |
87 ExtensionView* view = delegate_->extension_host()->view(); | 87 ExtensionView* view = delegate_->extension_host()->view(); |
88 view->SetBounds(x, 0, width() - x - kFarRightMargin - 1, height() - 1); | 88 view->SetBounds(x, 0, width() - x - kFarRightMargin - 1, height() - 1); |
89 } | 89 } |
90 | 90 |
91 void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) { | 91 void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) { |
92 if (!options_menu_contents_.get()) { | 92 if (!options_menu_contents_.get()) |
93 options_menu_contents_.reset(new ExtensionActionContextMenuModel( | 93 options_menu_contents_.reset(new ExtensionActionContextMenuModel( |
94 delegate_->extension_host()->extension())); | 94 delegate_->extension_host()->extension(), |
95 } | 95 // Do not include "Inspect Popup" in menu: |
| 96 NULL, // ExtensionAction |
| 97 NULL, // PrefService |
| 98 NULL)); // ExtensionActionContextMenuModel::MenuDelegate |
| 99 |
96 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); | 100 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); |
97 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); | 101 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); |
98 } | 102 } |
99 | 103 |
100 void ExtensionInfoBar::SetupIconAndMenu() { | 104 void ExtensionInfoBar::SetupIconAndMenu() { |
101 SkBitmap icon; | 105 SkBitmap icon; |
102 | 106 |
103 ExtensionResource icon_resource; | 107 ExtensionResource icon_resource; |
104 Extension::Icons size = delegate_->extension_host()->extension()-> | 108 Extension::Icons size = delegate_->extension_host()->extension()-> |
105 GetIconPathAllowLargerSize(&icon_resource, | 109 GetIconPathAllowLargerSize(&icon_resource, |
(...skipping 28 matching lines...) Expand all Loading... |
134 image_size + kDropArrowLeftMargin, | 138 image_size + kDropArrowLeftMargin, |
135 image_size / 2); | 139 image_size / 2); |
136 menu_->SetIcon(canvas->ExtractBitmap()); | 140 menu_->SetIcon(canvas->ExtractBitmap()); |
137 | 141 |
138 AddChildView(menu_); | 142 AddChildView(menu_); |
139 } | 143 } |
140 | 144 |
141 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { | 145 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { |
142 return new ExtensionInfoBar(this); | 146 return new ExtensionInfoBar(this); |
143 } | 147 } |
OLD | NEW |