Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 return true; | 1576 return true; |
| 1577 | 1577 |
| 1578 // Check the prefs. | 1578 // Check the prefs. |
| 1579 return extension_prefs_->IsIncognitoEnabled(extension_id); | 1579 return extension_prefs_->IsIncognitoEnabled(extension_id); |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 void ExtensionService::SetIsIncognitoEnabled( | 1582 void ExtensionService::SetIsIncognitoEnabled( |
| 1583 const std::string& extension_id, bool enabled) { | 1583 const std::string& extension_id, bool enabled) { |
| 1584 const Extension* extension = GetInstalledExtension(extension_id); | 1584 const Extension* extension = GetInstalledExtension(extension_id); |
| 1585 if (extension && extension->location() == Extension::COMPONENT) { | 1585 if (extension && extension->location() == Extension::COMPONENT) { |
| 1586 // This shouldn't be called for component extensions. | 1586 // This shouldn't be called for component extensions other than the |
| 1587 NOTREACHED(); | 1587 // web store (which is consider an app, and may try to set this value). |
| 1588 DCHECK_EQ(extension_misc::kWebStoreAppId, extension_id); | |
|
akalin
2012/02/03 01:44:43
flip argument order (unlike EXPECT_*, should match
csharp
2012/02/03 14:57:04
Done.
| |
| 1589 | |
| 1590 // If we are here with the CWS, make sure the we aren't trying to | |
| 1591 // change it. | |
| 1592 if (extension_id == extension_misc::kWebStoreAppId) | |
|
akalin
2012/02/03 01:44:43
i think this if statement is unnecessary; if you'r
csharp
2012/02/03 14:57:04
Done.
| |
| 1593 DCHECK_EQ(IsIncognitoEnabled(extension_id), enabled); | |
| 1594 | |
| 1588 return; | 1595 return; |
| 1589 } | 1596 } |
| 1590 | 1597 |
| 1591 // Broadcast unloaded and loaded events to update browser state. Only bother | 1598 // Broadcast unloaded and loaded events to update browser state. Only bother |
| 1592 // if the value changed and the extension is actually enabled, since there is | 1599 // if the value changed and the extension is actually enabled, since there is |
| 1593 // no UI otherwise. | 1600 // no UI otherwise. |
| 1594 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); | 1601 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); |
| 1595 if (enabled == old_enabled) | 1602 if (enabled == old_enabled) |
| 1596 return; | 1603 return; |
| 1597 | 1604 |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2702 // | 2709 // |
| 2703 // To coexist with certain unit tests that don't have an IO thread message | 2710 // To coexist with certain unit tests that don't have an IO thread message |
| 2704 // loop available at ExtensionService shutdown, we lazy-initialize this | 2711 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2705 // object so that those cases neither create nor destroy a SocketController. | 2712 // object so that those cases neither create nor destroy a SocketController. |
| 2706 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2713 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2707 if (!socket_controller_) { | 2714 if (!socket_controller_) { |
| 2708 socket_controller_ = new extensions::SocketController(); | 2715 socket_controller_ = new extensions::SocketController(); |
| 2709 } | 2716 } |
| 2710 return socket_controller_; | 2717 return socket_controller_; |
| 2711 } | 2718 } |
| OLD | NEW |