Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.cc

Issue 6989001: Misc. infobar stuff: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
11 #include "chrome/browser/ui/views/infobars/infobar_background.h" 11 #include "chrome/browser/ui/views/infobars/infobar_background.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_icon_set.h" 14 #include "chrome/common/extensions/extension_icon_set.h"
15 #include "chrome/common/extensions/extension_resource.h" 15 #include "chrome/common/extensions/extension_resource.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "ui/base/animation/slide_animation.h" 17 #include "ui/base/animation/slide_animation.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/canvas_skia.h" 19 #include "ui/gfx/canvas_skia.h"
20 #include "views/controls/button/menu_button.h" 20 #include "views/controls/button/menu_button.h"
21 #include "views/controls/menu/menu_2.h" 21 #include "views/controls/menu/menu_2.h"
22 #include "views/widget/widget.h" 22 #include "views/widget/widget.h"
23 23
24 // ExtensionInfoBarDelegate --------------------------------------------------- 24 // ExtensionInfoBarDelegate ---------------------------------------------------
25 25
26 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { 26 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) {
27 return new ExtensionInfoBar(this); 27 return new ExtensionInfoBar(owner, this);
28 } 28 }
29 29
30 // ExtensionInfoBar ----------------------------------------------------------- 30 // ExtensionInfoBar -----------------------------------------------------------
31 31
32 namespace { 32 namespace {
33 // The horizontal margin between the menu and the Extension (HTML) view. 33 // The horizontal margin between the menu and the Extension (HTML) view.
34 static const int kMenuHorizontalMargin = 1; 34 static const int kMenuHorizontalMargin = 1;
35 }; 35 };
36 36
37 ExtensionInfoBar::ExtensionInfoBar(ExtensionInfoBarDelegate* delegate) 37 ExtensionInfoBar::ExtensionInfoBar(TabContentsWrapper* owner,
38 : InfoBarView(delegate), 38 ExtensionInfoBarDelegate* delegate)
39 : InfoBarView(owner, delegate),
39 delegate_(delegate), 40 delegate_(delegate),
40 menu_(NULL), 41 menu_(NULL),
41 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { 42 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {
42 delegate->set_observer(this); 43 delegate->set_observer(this);
43 44
44 ExtensionView* extension_view = delegate->extension_host()->view(); 45 ExtensionView* extension_view = delegate->extension_host()->view();
45 int height = extension_view->GetPreferredSize().height(); 46 int height = extension_view->GetPreferredSize().height();
46 SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0); 47 SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0);
47 48
48 // Get notified of resize events for the ExtensionView. 49 // Get notified of resize events for the ExtensionView.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 NULL); 184 NULL);
184 } 185 }
185 186
186 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); 187 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get()));
187 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); 188 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT);
188 } 189 }
189 190
190 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 191 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
191 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 192 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
192 } 193 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.h ('k') | chrome/browser/ui/views/infobars/infobar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698