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

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

Issue 7796010: Attempt at fixing crash in menus shown from infobars. Here's what the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change comment and remove change to views Created 9 years, 3 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 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/extensions/image_loading_tracker.h" 10 #include "chrome/browser/extensions/image_loading_tracker.h"
11 #include "chrome/browser/ui/views/infobars/infobar_view.h" 11 #include "chrome/browser/ui/views/infobars/infobar_view.h"
12 #include "views/controls/menu/view_menu_delegate.h" 12 #include "views/controls/menu/view_menu_delegate.h"
13 13
14 class TabContentsWrapper; 14 class TabContentsWrapper;
15 namespace views { 15 namespace views {
16 class MenuButton; 16 class MenuButton;
17 class MenuRunner;
18 } 17 }
19 18
20 class ExtensionInfoBar : public InfoBarView, 19 class ExtensionInfoBar : public InfoBarView,
21 public ImageLoadingTracker::Observer, 20 public ImageLoadingTracker::Observer,
22 public ExtensionInfoBarDelegate::DelegateObserver, 21 public ExtensionInfoBarDelegate::DelegateObserver,
23 public views::ViewMenuDelegate { 22 public views::ViewMenuDelegate {
24 public: 23 public:
25 ExtensionInfoBar(TabContentsWrapper* owner, 24 ExtensionInfoBar(TabContentsWrapper* owner,
26 ExtensionInfoBarDelegate* delegate); 25 ExtensionInfoBarDelegate* delegate);
27 26
28 private: 27 private:
29 virtual ~ExtensionInfoBar(); 28 virtual ~ExtensionInfoBar();
30 29
31 // InfoBarView: 30 // InfoBarView:
32 virtual void Layout(); 31 virtual void Layout() OVERRIDE;
33 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); 32 virtual void ViewHierarchyChanged(bool is_add,
34 virtual int ContentMinimumWidth() const; 33 View* parent,
34 View* child) OVERRIDE;
35 virtual int ContentMinimumWidth() const OVERRIDE;
35 36
36 // ImageLoadingTracker::Observer: 37 // ImageLoadingTracker::Observer:
37 virtual void OnImageLoaded(SkBitmap* image, 38 virtual void OnImageLoaded(SkBitmap* image,
38 const ExtensionResource& resource, 39 const ExtensionResource& resource,
39 int index); 40 int index);
40 41
41 // ExtensionInfoBarDelegate::DelegateObserver: 42 // ExtensionInfoBarDelegate::DelegateObserver:
42 virtual void OnDelegateDeleted(); 43 virtual void OnDelegateDeleted();
43 44
44 // views::ViewMenuDelegate: 45 // views::ViewMenuDelegate:
45 virtual void RunMenu(View* source, const gfx::Point& pt); 46 virtual void RunMenu(View* source, const gfx::Point& pt);
46 47
47 ExtensionInfoBarDelegate* GetDelegate(); 48 ExtensionInfoBarDelegate* GetDelegate();
48 49
49 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once 50 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once
50 // InfoBars own their delegates (and thus we don't need the DelegateObserver 51 // InfoBars own their delegates (and thus we don't need the DelegateObserver
51 // functionality). For now, almost everyone should use GetDelegate() instead. 52 // functionality). For now, almost everyone should use GetDelegate() instead.
52 InfoBarDelegate* delegate_; 53 InfoBarDelegate* delegate_;
53 54
54 // The dropdown menu for accessing the contextual extension actions. 55 // The dropdown menu for accessing the contextual extension actions.
55 views::MenuButton* menu_; 56 views::MenuButton* menu_;
56 57
57 // Keeps track of images being loaded on the File thread. 58 // Keeps track of images being loaded on the File thread.
58 ImageLoadingTracker tracker_; 59 ImageLoadingTracker tracker_;
59 60
60 scoped_ptr<views::MenuRunner> menu_runner_;
61
62 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); 61 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar);
63 }; 62 };
64 63
65 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 64 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698