OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_util.h" | 5 #include "chrome/browser/extensions/extension_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (update_permissions) { | 92 if (update_permissions) { |
93 const Extension* extension = | 93 const Extension* extension = |
94 ExtensionRegistry::Get(context)->enabled_extensions().GetByID( | 94 ExtensionRegistry::Get(context)->enabled_extensions().GetByID( |
95 extension_id); | 95 extension_id); |
96 if (extension) { | 96 if (extension) { |
97 PermissionsUpdater updater(context); | 97 PermissionsUpdater updater(context); |
98 if (allowed) | 98 if (allowed) |
99 updater.GrantWithheldImpliedAllHosts(extension); | 99 updater.GrantWithheldImpliedAllHosts(extension); |
100 else | 100 else |
101 updater.WithholdImpliedAllHosts(extension); | 101 updater.WithholdImpliedAllHosts(extension); |
| 102 |
| 103 // If this was an update to permissions, we also need to sync the change. |
| 104 ExtensionSyncService* sync_service = ExtensionSyncService::Get(context); |
| 105 if (sync_service) // sync_service can be null in unittests. |
| 106 sync_service->SyncExtensionChangeIfNeeded(*extension); |
102 } | 107 } |
103 } | 108 } |
104 } | 109 } |
105 | 110 |
106 } // namespace | 111 } // namespace |
107 | 112 |
108 bool IsIncognitoEnabled(const std::string& extension_id, | 113 bool IsIncognitoEnabled(const std::string& extension_id, |
109 content::BrowserContext* context) { | 114 content::BrowserContext* context) { |
110 const Extension* extension = ExtensionRegistry::Get(context)-> | 115 const Extension* extension = ExtensionRegistry::Get(context)-> |
111 GetExtensionById(extension_id, ExtensionRegistry::ENABLED); | 116 GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 IDR_EXTENSION_DEFAULT_ICON); | 397 IDR_EXTENSION_DEFAULT_ICON); |
393 } | 398 } |
394 | 399 |
395 bool IsNewBookmarkAppsEnabled() { | 400 bool IsNewBookmarkAppsEnabled() { |
396 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 401 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
397 switches::kDisableNewBookmarkApps); | 402 switches::kDisableNewBookmarkApps); |
398 } | 403 } |
399 | 404 |
400 } // namespace util | 405 } // namespace util |
401 } // namespace extensions | 406 } // namespace extensions |
OLD | NEW |