[Extensions] Sync the 'allowed scripting on all urls' preference

Sync the flag for whether or not an extension is allowed to script on all urls,
independent of the flag to enable the feature. This (eventually) allows people
to install extensions on a machine with the flag without the scary warning
about what will happen if it's synced.

BUG=452756

Review URL: https://codereview.chromium.org/907533004

Cr-Commit-Position: refs/heads/master@{#316100}
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 8cf30d4..29479c49f 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -99,6 +99,11 @@
         updater.GrantWithheldImpliedAllHosts(extension);
       else
         updater.WithholdImpliedAllHosts(extension);
+
+      // If this was an update to permissions, we also need to sync the change.
+      ExtensionSyncService* sync_service = ExtensionSyncService::Get(context);
+      if (sync_service)  // sync_service can be null in unittests.
+        sync_service->SyncExtensionChangeIfNeeded(*extension);
     }
   }
 }