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

Side by Side Diff: chrome/browser/extensions/extension_util.cc

Issue 907533004: [Extensions] Sync the 'allowed scripting on all urls' preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_sync_service.cc ('k') | chrome/browser/sync/test/integration/two_client_apps_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698