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

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

Issue 21443002: Add NOTIFICATION_EXTENSION_REMOVED for Extensions removed from ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/extensions/external_install_ui.h" 5 #include "chrome/browser/extensions/external_install_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 // ExternalInstallMenuAlert ------------------------------------------------- 238 // ExternalInstallMenuAlert -------------------------------------------------
239 239
240 ExternalInstallMenuAlert::ExternalInstallMenuAlert( 240 ExternalInstallMenuAlert::ExternalInstallMenuAlert(
241 ExtensionService* service, 241 ExtensionService* service,
242 const Extension* extension) 242 const Extension* extension)
243 : service_(service), 243 : service_(service),
244 extension_(extension) { 244 extension_(extension) {
245 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 245 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
246 content::Source<Profile>(service->profile())); 246 content::Source<Profile>(service->profile()));
247 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 247 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED,
248 content::Source<Profile>(service->profile())); 248 content::Source<Profile>(service->profile()));
249 } 249 }
250 250
251 ExternalInstallMenuAlert::~ExternalInstallMenuAlert() { 251 ExternalInstallMenuAlert::~ExternalInstallMenuAlert() {
252 } 252 }
253 253
254 GlobalError::Severity ExternalInstallMenuAlert::GetSeverity() { 254 GlobalError::Severity ExternalInstallMenuAlert::GetSeverity() {
255 return SEVERITY_LOW; 255 return SEVERITY_LOW;
256 } 256 }
257 257
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 void ExternalInstallMenuAlert::BubbleViewCancelButtonPressed( 309 void ExternalInstallMenuAlert::BubbleViewCancelButtonPressed(
310 Browser* browser) { 310 Browser* browser) {
311 NOTREACHED(); 311 NOTREACHED();
312 } 312 }
313 313
314 void ExternalInstallMenuAlert::Observe( 314 void ExternalInstallMenuAlert::Observe(
315 int type, 315 int type,
316 const content::NotificationSource& source, 316 const content::NotificationSource& source,
317 const content::NotificationDetails& details) { 317 const content::NotificationDetails& details) {
318 const Extension* extension = NULL; 318 // The error is invalidated if the extension has been loaded or removed.
319 // The error is invalidated if the extension has been reloaded or unloaded. 319 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED ||
320 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { 320 type == chrome::NOTIFICATION_EXTENSION_REMOVED);
321 extension = content::Details<const Extension>(details).ptr(); 321 const Extension* extension = content::Details<const Extension>(details).ptr();
322 } else { 322 if (extension != extension_)
323 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); 323 return;
324 extensions::UnloadedExtensionInfo* info = 324 GlobalErrorService* error_service =
325 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); 325 GlobalErrorServiceFactory::GetForProfile(service_->profile());
326 extension = info->extension; 326 error_service->RemoveGlobalError(this);
327 } 327 service_->AcknowledgeExternalExtension(extension_->id());
328 if (extension == extension_) { 328 delete this;
329 GlobalErrorService* error_service =
330 GlobalErrorServiceFactory::GetForProfile(service_->profile());
331 error_service->RemoveGlobalError(this);
332 service_->AcknowledgeExternalExtension(extension_->id());
333 delete this;
334 }
335 } 329 }
336 330
337 // ExternalInstallGlobalError ----------------------------------------------- 331 // ExternalInstallGlobalError -----------------------------------------------
338 332
339 ExternalInstallGlobalError::ExternalInstallGlobalError( 333 ExternalInstallGlobalError::ExternalInstallGlobalError(
340 ExtensionService* service, 334 ExtensionService* service,
341 const Extension* extension, 335 const Extension* extension,
342 ExternalInstallDialogDelegate* delegate, 336 ExternalInstallDialogDelegate* delegate,
343 const ExtensionInstallPrompt::Prompt& prompt) 337 const ExtensionInstallPrompt::Prompt& prompt)
344 : ExternalInstallMenuAlert(service, extension), 338 : ExternalInstallMenuAlert(service, extension),
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 453
460 bool HasExternalInstallBubble(ExtensionService* service) { 454 bool HasExternalInstallBubble(ExtensionService* service) {
461 GlobalErrorService* error_service = 455 GlobalErrorService* error_service =
462 GlobalErrorServiceFactory::GetForProfile(service->profile()); 456 GlobalErrorServiceFactory::GetForProfile(service->profile());
463 GlobalError* error = error_service->GetGlobalErrorByMenuItemCommandID( 457 GlobalError* error = error_service->GetGlobalErrorByMenuItemCommandID(
464 kMenuCommandId); 458 kMenuCommandId);
465 return error && error->HasBubbleView(); 459 return error && error->HasBubbleView();
466 } 460 }
467 461
468 } // namespace extensions 462 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698