| 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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 return true; | 1566 return true; |
| 1567 | 1567 |
| 1568 // Check the prefs. | 1568 // Check the prefs. |
| 1569 return extension_prefs_->IsIncognitoEnabled(extension_id); | 1569 return extension_prefs_->IsIncognitoEnabled(extension_id); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void ExtensionService::SetIsIncognitoEnabled( | 1572 void ExtensionService::SetIsIncognitoEnabled( |
| 1573 const std::string& extension_id, bool enabled) { | 1573 const std::string& extension_id, bool enabled) { |
| 1574 const Extension* extension = GetInstalledExtension(extension_id); | 1574 const Extension* extension = GetInstalledExtension(extension_id); |
| 1575 if (extension && extension->location() == Extension::COMPONENT) { | 1575 if (extension && extension->location() == Extension::COMPONENT) { |
| 1576 // This shouldn't be called for component extensions. | 1576 // This shouldn't be called for component extensions other than the |
| 1577 NOTREACHED(); | 1577 // web store (which is considered an app, and may try to set this value). |
| 1578 DCHECK_EQ(extension_id, std::string(extension_misc::kWebStoreAppId)); |
| 1579 |
| 1580 // If we are here with the CWS, make sure the we aren't trying to |
| 1581 // change it. |
| 1582 DCHECK_EQ(enabled, IsIncognitoEnabled(extension_id)); |
| 1583 |
| 1578 return; | 1584 return; |
| 1579 } | 1585 } |
| 1580 | 1586 |
| 1581 // Broadcast unloaded and loaded events to update browser state. Only bother | 1587 // Broadcast unloaded and loaded events to update browser state. Only bother |
| 1582 // if the value changed and the extension is actually enabled, since there is | 1588 // if the value changed and the extension is actually enabled, since there is |
| 1583 // no UI otherwise. | 1589 // no UI otherwise. |
| 1584 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); | 1590 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); |
| 1585 if (enabled == old_enabled) | 1591 if (enabled == old_enabled) |
| 1586 return; | 1592 return; |
| 1587 | 1593 |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 // | 2698 // |
| 2693 // To coexist with certain unit tests that don't have an IO thread message | 2699 // To coexist with certain unit tests that don't have an IO thread message |
| 2694 // loop available at ExtensionService shutdown, we lazy-initialize this | 2700 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2695 // object so that those cases neither create nor destroy a SocketController. | 2701 // object so that those cases neither create nor destroy a SocketController. |
| 2696 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2702 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2697 if (!socket_controller_) { | 2703 if (!socket_controller_) { |
| 2698 socket_controller_ = new extensions::SocketController(); | 2704 socket_controller_ = new extensions::SocketController(); |
| 2699 } | 2705 } |
| 2700 return socket_controller_; | 2706 return socket_controller_; |
| 2701 } | 2707 } |
| OLD | NEW |