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

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

Issue 342003005: Show alert failure for reloading unpacked extensions with bad manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added ReloadExtensionImpl, enhanced loader handler to send ListValue of failures Created 6 years, 5 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
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_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void SetBeingReloaded(const std::string& extension_id, bool value); 230 void SetBeingReloaded(const std::string& extension_id, bool value);
231 231
232 // Initialize and start all installed extensions. 232 // Initialize and start all installed extensions.
233 void Init(); 233 void Init();
234 234
235 // Called when the associated Profile is going to be destroyed. 235 // Called when the associated Profile is going to be destroyed.
236 void Shutdown(); 236 void Shutdown();
237 237
238 // Reloads the specified extension, sending the onLaunched() event to it if it 238 // Reloads the specified extension, sending the onLaunched() event to it if it
239 // currently has any window showing. 239 // currently has any window showing.
240 void ReloadExtension(const std::string& extension_id); 240 // Public method for ReloadExtensionImpl. Allows noisy failures.
Devlin 2014/07/07 20:44:21 No point in saying "Public method for x". Just sa
gpdavis 2014/07/09 01:35:56 Done.
241 void ReloadExtension(const std::string& extension_id) {
242 ReloadExtensionImpl(extension_id, true /* be_noisy */);
Devlin 2014/07/07 20:44:21 These calls should actually be in the .cc file.
gpdavis 2014/07/09 01:35:56 Done.
243 }
244
245 // Public method for ReloadExtensionImpl. Suppresses noisy failures.
246 void ReloadExtensionWithQuietFailure(const std::string& extension_id) {
247 ReloadExtensionImpl(extension_id, false /* be_noisy */);
248 }
241 249
242 // Uninstalls the specified extension. Callers should only call this method 250 // Uninstalls the specified extension. Callers should only call this method
243 // with extensions that exist. |external_uninstall| is a magical parameter 251 // with extensions that exist. |external_uninstall| is a magical parameter
244 // that is only used to send information to ExtensionPrefs, which external 252 // that is only used to send information to ExtensionPrefs, which external
245 // callers should never set to true. 253 // callers should never set to true.
246 // 254 //
247 // TODO(aa): Remove |external_uninstall| -- this information should be passed 255 // TODO(aa): Remove |external_uninstall| -- this information should be passed
248 // to ExtensionPrefs some other way. 256 // to ExtensionPrefs some other way.
249 virtual bool UninstallExtension(const std::string& extension_id, 257 virtual bool UninstallExtension(const std::string& extension_id,
250 bool external_uninstall, 258 bool external_uninstall,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 443
436 // Set a callback to be called when all external providers are ready and their 444 // Set a callback to be called when all external providers are ready and their
437 // extensions have been installed. 445 // extensions have been installed.
438 void set_external_updates_finished_callback_for_test( 446 void set_external_updates_finished_callback_for_test(
439 const base::Closure& callback) { 447 const base::Closure& callback) {
440 external_updates_finished_callback_ = callback; 448 external_updates_finished_callback_ = callback;
441 } 449 }
442 450
443 451
444 private: 452 private:
453 // Reloads the specified extension, sending the onLaunched() event to it if it
454 // currently has any window showing. |be_noisy| determines whether noisy
455 // failures are allowed for unpacked extension installs.
456 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy);
457
445 // content::NotificationObserver implementation: 458 // content::NotificationObserver implementation:
446 virtual void Observe(int type, 459 virtual void Observe(int type,
447 const content::NotificationSource& source, 460 const content::NotificationSource& source,
448 const content::NotificationDetails& details) OVERRIDE; 461 const content::NotificationDetails& details) OVERRIDE;
449 462
450 // extensions::Blacklist::Observer implementation. 463 // extensions::Blacklist::Observer implementation.
451 virtual void OnBlacklistUpdated() OVERRIDE; 464 virtual void OnBlacklistUpdated() OVERRIDE;
452 465
453 // Similar to FinishInstallation, but first checks if there still is an update 466 // Similar to FinishInstallation, but first checks if there still is an update
454 // pending for the extension, and makes sure the extension is still idle. 467 // pending for the extension, and makes sure the extension is still idle.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 GreylistedExtensionDisabled); 728 GreylistedExtensionDisabled);
716 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 729 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
717 GreylistDontEnableManuallyDisabled); 730 GreylistDontEnableManuallyDisabled);
718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 731 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
719 GreylistUnknownDontChange); 732 GreylistUnknownDontChange);
720 733
721 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 734 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
722 }; 735 };
723 736
724 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 737 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698