+ StopObservingExtensionRegistry();
+}
+
+void AppInfoDialog::Close() {
+ GetWidget()->Close();
+}
+
+void AppInfoDialog::StartObservingExtensionRegistry() {
+ DCHECK(!extension_registry_);
+
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile_);
+ extension_registry_->AddObserver(this);
+}
+
+void AppInfoDialog::StopObservingExtensionRegistry() {
+ if (extension_registry_)
+ extension_registry_->RemoveObserver(this);
+ extension_registry_ = NULL;
+}
+
+void AppInfoDialog::OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
+ if (extension->id() != app_id_)
+ return;
+
+ Close();
+}
+
+void AppInfoDialog::OnShutdown(extensions::ExtensionRegistry* registry) {
+ DCHECK_EQ(extension_registry_, registry);
+ StopObservingExtensionRegistry();
+ Close();