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

Side by Side Diff: chrome/browser/extensions/extension_infobar_delegate.h

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 12
13 class Browser; 13 class Browser;
14 class GURL; 14 class GURL;
15 class InfoBarTabService;
15 16
16 namespace extensions { 17 namespace extensions {
17 class Extension; 18 class Extension;
18 class ExtensionHost; 19 class ExtensionHost;
19 } 20 }
20 21
21 // The InfobarDelegate for creating and managing state for the ExtensionInfobar 22 // The InfobarDelegate for creating and managing state for the ExtensionInfobar
22 // plus monitor when the extension goes away. 23 // plus monitor when the extension goes away.
23 class ExtensionInfoBarDelegate : public InfoBarDelegate, 24 class ExtensionInfoBarDelegate : public InfoBarDelegate,
24 public content::NotificationObserver { 25 public content::NotificationObserver {
25 public: 26 public:
26 // The observer for when the delegate dies. 27 // The observer for when the delegate dies.
27 class DelegateObserver { 28 class DelegateObserver {
28 public: 29 public:
29 virtual void OnDelegateDeleted() = 0; 30 virtual void OnDelegateDeleted() = 0;
30 31
31 protected: 32 protected:
32 virtual ~DelegateObserver() {} 33 virtual ~DelegateObserver() {}
33 }; 34 };
34 35
35 ExtensionInfoBarDelegate(Browser* browser, 36 ExtensionInfoBarDelegate(Browser* browser,
36 InfoBarTabHelper* infobar_helper, 37 InfoBarTabService* infobar_service,
37 const extensions::Extension* extension, 38 const extensions::Extension* extension,
38 const GURL& url, 39 const GURL& url,
39 int height); 40 int height);
40 41
41 const extensions::Extension* extension() { return extension_; } 42 const extensions::Extension* extension() { return extension_; }
42 extensions::ExtensionHost* extension_host() { return extension_host_.get(); } 43 extensions::ExtensionHost* extension_host() { return extension_host_.get(); }
43 int height() { return height_; } 44 int height() { return height_; }
44 45
45 void set_observer(DelegateObserver* observer) { observer_ = observer; } 46 void set_observer(DelegateObserver* observer) { observer_ = observer; }
46 47
47 bool closing() const { return closing_; } 48 bool closing() const { return closing_; }
48 49
49 private: 50 private:
50 virtual ~ExtensionInfoBarDelegate(); 51 virtual ~ExtensionInfoBarDelegate();
51 52
52 // InfoBarDelegate: 53 // InfoBarDelegate:
53 virtual InfoBar* CreateInfoBar(InfoBarTabHelper* owner) OVERRIDE; 54 virtual InfoBar* CreateInfoBar(InfoBarTabService* owner) OVERRIDE;
54 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; 55 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE;
55 virtual void InfoBarDismissed() OVERRIDE; 56 virtual void InfoBarDismissed() OVERRIDE;
56 virtual Type GetInfoBarType() const OVERRIDE; 57 virtual Type GetInfoBarType() const OVERRIDE;
57 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; 58 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE;
58 59
59 // content::NotificationObserver: 60 // content::NotificationObserver:
60 virtual void Observe(int type, 61 virtual void Observe(int type,
61 const content::NotificationSource& source, 62 const content::NotificationSource& source,
62 const content::NotificationDetails& details) OVERRIDE; 63 const content::NotificationDetails& details) OVERRIDE;
63 64
(...skipping 15 matching lines...) Expand all
79 int height_; 80 int height_;
80 81
81 // Whether we are currently animating to close. This is used to ignore 82 // Whether we are currently animating to close. This is used to ignore
82 // ExtensionView::PreferredSizeChanged notifications. 83 // ExtensionView::PreferredSizeChanged notifications.
83 bool closing_; 84 bool closing_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); 86 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate);
86 }; 87 };
87 88
88 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_infobar_delegate.cc ('k') | chrome/browser/extensions/extension_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698