Chromium Code Reviews| 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1493 | 1493 |
| 1494 // Broadcast unloaded and loaded events to update browser state. Only bother | 1494 // Broadcast unloaded and loaded events to update browser state. Only bother |
| 1495 // if the value changed and the extension is actually enabled, since there is | 1495 // if the value changed and the extension is actually enabled, since there is |
| 1496 // no UI otherwise. | 1496 // no UI otherwise. |
| 1497 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); | 1497 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); |
| 1498 if (enabled == old_enabled) | 1498 if (enabled == old_enabled) |
| 1499 return; | 1499 return; |
| 1500 | 1500 |
| 1501 extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled); | 1501 extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled); |
| 1502 | 1502 |
| 1503 bool extension_is_enabled = extensions_.Contains(extension->id()); | 1503 bool extension_is_enabled = extension ? |
|
Yoyo Zhou
2011/12/09 22:01:23
I believe extension->id() should be extension_id (
| |
| 1504 extensions_.Contains(extension->id()) : false; | |
| 1504 | 1505 |
| 1505 // When we reload the extension the ID may be invalidated if we've passed it | 1506 // When we reload the extension the ID may be invalidated if we've passed it |
| 1506 // by const ref everywhere. Make a copy to be safe. | 1507 // by const ref everywhere. Make a copy to be safe. |
| 1507 std::string id = extension_id; | 1508 std::string id = extension_id; |
| 1508 if (extension_is_enabled) | 1509 if (extension_is_enabled) |
| 1509 ReloadExtension(extension->id()); | 1510 ReloadExtension(extension->id()); |
|
Yoyo Zhou
2011/12/09 22:01:23
Same here -- although if we get here then extensio
| |
| 1510 | 1511 |
| 1511 // Reloading the extension invalidates the |extension| pointer. | 1512 // Reloading the extension invalidates the |extension| pointer. |
| 1512 extension = GetInstalledExtension(id); | 1513 extension = GetInstalledExtension(id); |
| 1513 if (extension) | 1514 if (extension) |
| 1514 SyncExtensionChangeIfNeeded(*extension); | 1515 SyncExtensionChangeIfNeeded(*extension); |
| 1515 } | 1516 } |
| 1516 | 1517 |
| 1517 void ExtensionService::SetAppNotificationSetupDone( | 1518 void ExtensionService::SetAppNotificationSetupDone( |
| 1518 const std::string& extension_id, | 1519 const std::string& extension_id, |
| 1519 const std::string& oauth_client_id) { | 1520 const std::string& oauth_client_id) { |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2515 | 2516 |
| 2516 ExtensionService::NaClModuleInfoList::iterator | 2517 ExtensionService::NaClModuleInfoList::iterator |
| 2517 ExtensionService::FindNaClModule(const GURL& url) { | 2518 ExtensionService::FindNaClModule(const GURL& url) { |
| 2518 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2519 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2519 iter != nacl_module_list_.end(); ++iter) { | 2520 iter != nacl_module_list_.end(); ++iter) { |
| 2520 if (iter->url == url) | 2521 if (iter->url == url) |
| 2521 return iter; | 2522 return iter; |
| 2522 } | 2523 } |
| 2523 return nacl_module_list_.end(); | 2524 return nacl_module_list_.end(); |
| 2524 } | 2525 } |
| OLD | NEW |