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

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

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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) 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_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/infobars/infobar_tab_helper.h"
10 #include "chrome/browser/platform_util.h" 11 #include "chrome/browser/platform_util.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/extension_icon_set.h" 14 #include "chrome/common/extensions/extension_icon_set.h"
14 #include "chrome/common/extensions/extension_resource.h" 15 #include "chrome/common/extensions/extension_resource.h"
15 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
16 #include "ui/base/animation/slide_animation.h" 17 #include "ui/base/animation/slide_animation.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/image/canvas_image_source.h" 20 #include "ui/gfx/image/canvas_image_source.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 #include "ui/views/controls/button/menu_button.h" 22 #include "ui/views/controls/button/menu_button.h"
22 #include "ui/views/controls/menu/menu_item_view.h" 23 #include "ui/views/controls/menu/menu_item_view.h"
23 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
24 25
25 // ExtensionInfoBarDelegate ---------------------------------------------------- 26 // ExtensionInfoBarDelegate ----------------------------------------------------
26 27
27 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 28 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) {
28 return new ExtensionInfoBar(browser_, owner, this); 29 return new ExtensionInfoBar(
30 browser_, static_cast<InfoBarTabHelper*>(owner), this);
29 } 31 }
30 32
31 // ExtensionInfoBar ------------------------------------------------------------ 33 // ExtensionInfoBar ------------------------------------------------------------
32 34
33 namespace { 35 namespace {
34 // The horizontal margin between the menu and the Extension (HTML) view. 36 // The horizontal margin between the menu and the Extension (HTML) view.
35 const int kMenuHorizontalMargin = 1; 37 const int kMenuHorizontalMargin = 1;
36 38
37 class MenuImageSource: public gfx::CanvasImageSource { 39 class MenuImageSource: public gfx::CanvasImageSource {
38 public: 40 public:
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 182
181 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = 183 scoped_refptr<ExtensionContextMenuModel> options_menu_contents =
182 new ExtensionContextMenuModel(extension, browser_); 184 new ExtensionContextMenuModel(extension, browser_);
183 DCHECK_EQ(menu_, source); 185 DCHECK_EQ(menu_, source);
184 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); 186 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT);
185 } 187 }
186 188
187 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 189 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
188 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 190 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
189 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698