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

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

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 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/extensions/extension_infobar_delegate.h" 5 #include "chrome/browser/extensions/extension_infobar_delegate.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
(...skipping 20 matching lines...) Expand all
32 Source<Profile>(browser->profile())); 32 Source<Profile>(browser->profile()));
33 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, 33 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
34 Source<Profile>(browser->profile())); 34 Source<Profile>(browser->profile()));
35 } 35 }
36 36
37 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() { 37 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {
38 if (observer_) 38 if (observer_)
39 observer_->OnDelegateDeleted(); 39 observer_->OnDelegateDeleted();
40 } 40 }
41 41
42 void ExtensionInfoBarDelegate::InfoBarDismissed() {
43 closing_ = true;
44 }
45
46 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 42 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
47 ExtensionInfoBarDelegate* extension_delegate = 43 ExtensionInfoBarDelegate* extension_delegate =
48 delegate->AsExtensionInfoBarDelegate(); 44 delegate->AsExtensionInfoBarDelegate();
49 // When an extension crashes, an InfoBar is shown (for the crashed extension). 45 // When an extension crashes, an InfoBar is shown (for the crashed extension).
50 // That will result in a call to this function (to see if this InfoBarDelegate 46 // That will result in a call to this function (to see if this InfoBarDelegate
51 // is already showing the 'extension crashed InfoBar', which it never is), but 47 // is already showing the 'extension crashed InfoBar', which it never is), but
52 // if it is our extension that crashes, the extension delegate is NULL so 48 // if it is our extension that crashes, the extension delegate is NULL so
53 // we cannot check. 49 // we cannot check.
54 if (!extension_delegate) 50 if (!extension_delegate)
55 return false; 51 return false;
56 52
57 // Only allow one InfoBar at a time per extension. 53 // Only allow one InfoBar at a time per extension.
58 return extension_delegate->extension_host()->extension() == 54 return extension_delegate->extension_host()->extension() ==
59 extension_host_->extension(); 55 extension_host_->extension();
60 } 56 }
61 57
58 void ExtensionInfoBarDelegate::InfoBarDismissed() {
59 closing_ = true;
60 }
61
62 void ExtensionInfoBarDelegate::InfoBarClosed() { 62 void ExtensionInfoBarDelegate::InfoBarClosed() {
63 delete this; 63 delete this;
64 } 64 }
65 65
66 ExtensionInfoBarDelegate* 66 InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() const {
67 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() { 67 return PAGE_ACTION_TYPE;
68 return this;
69 } 68 }
70 69
71 InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() { 70 ExtensionInfoBarDelegate*
72 return PAGE_ACTION_TYPE; 71 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() {
72 return this;
73 } 73 }
74 74
75 void ExtensionInfoBarDelegate::Observe(NotificationType type, 75 void ExtensionInfoBarDelegate::Observe(NotificationType type,
76 const NotificationSource& source, 76 const NotificationSource& source,
77 const NotificationDetails& details) { 77 const NotificationDetails& details) {
78 switch (type.value) { 78 switch (type.value) {
79 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { 79 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: {
80 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); 80 const ExtensionHost* result = Details<ExtensionHost>(details).ptr();
81 if (extension_host_.get() == result) 81 if (extension_host_.get() == result)
82 tab_contents_->RemoveInfoBar(this); 82 tab_contents_->RemoveInfoBar(this);
83 break; 83 break;
84 } 84 }
85 case NotificationType::EXTENSION_UNLOADED: { 85 case NotificationType::EXTENSION_UNLOADED: {
86 const Extension* extension = 86 const Extension* extension =
87 Details<UnloadedExtensionInfo>(details)->extension; 87 Details<UnloadedExtensionInfo>(details)->extension;
88 if (extension_ == extension) 88 if (extension_ == extension)
89 tab_contents_->RemoveInfoBar(this); 89 tab_contents_->RemoveInfoBar(this);
90 break; 90 break;
91 } 91 }
92 default: { 92 default: {
93 NOTREACHED() << "Unknown message"; 93 NOTREACHED() << "Unknown message";
94 break; 94 break;
95 } 95 }
96 } 96 }
97 } 97 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.h ('k') | chrome/browser/extensions/extension_install_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698