OLD | NEW |
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/extensions/extension_disabled_infobar_delegate.h" | 5 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const NotificationSource& source, | 155 const NotificationSource& source, |
156 const NotificationDetails& details) { | 156 const NotificationDetails& details) { |
157 // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us getting | 157 // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us getting |
158 // deleted. | 158 // deleted. |
159 const Extension* extension = NULL; | 159 const Extension* extension = NULL; |
160 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 160 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
161 extension = Details<const Extension>(details).ptr(); | 161 extension = Details<const Extension>(details).ptr(); |
162 } else { | 162 } else { |
163 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); | 163 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); |
164 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); | 164 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); |
165 if (info->reason == UnloadedExtensionInfo::DISABLE || | 165 if (info->reason == extension_misc::UNLOAD_REASON_DISABLE || |
166 info->reason == UnloadedExtensionInfo::UNINSTALL) | 166 info->reason == extension_misc::UNLOAD_REASON_UNINSTALL) |
167 extension = info->extension; | 167 extension = info->extension; |
168 } | 168 } |
169 if (extension == extension_) | 169 if (extension == extension_) |
170 RemoveSelf(); | 170 RemoveSelf(); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 // Globals -------------------------------------------------------------------- | 174 // Globals -------------------------------------------------------------------- |
175 | 175 |
176 void ShowExtensionDisabledUI(ExtensionService* service, Profile* profile, | 176 void ShowExtensionDisabledUI(ExtensionService* service, Profile* profile, |
177 const Extension* extension) { | 177 const Extension* extension) { |
178 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 178 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
179 if (!browser) | 179 if (!browser) |
180 return; | 180 return; |
181 | 181 |
182 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); | 182 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); |
183 if (!tab_contents) | 183 if (!tab_contents) |
184 return; | 184 return; |
185 | 185 |
186 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( | 186 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( |
187 tab_contents, service, extension)); | 187 tab_contents, service, extension)); |
188 } | 188 } |
189 | 189 |
190 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile, | 190 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile, |
191 const Extension* extension) { | 191 const Extension* extension) { |
192 // This object manages its own lifetime. | 192 // This object manages its own lifetime. |
193 new ExtensionDisabledDialogDelegate(profile, service, extension); | 193 new ExtensionDisabledDialogDelegate(profile, service, extension); |
194 } | 194 } |
OLD | NEW |