Fix force policy installation of the removed pref-installed extension

This fixes the issue with the extension not being force-installed
through the admin policy when it was previously installed by the
external preference and then manually removed by the user.

BUG=651197
TEST=Unit test

Review-Url: https://codereview.chromium.org/2409743002
Cr-Commit-Position: refs/heads/master@{#424245}
diff --git a/chrome/browser/extensions/pending_extension_manager.cc b/chrome/browser/extensions/pending_extension_manager.cc
index 515f01e..36038b9 100644
--- a/chrome/browser/extensions/pending_extension_manager.cc
+++ b/chrome/browser/extensions/pending_extension_manager.cc
@@ -194,8 +194,12 @@
     // If the new location has higher priority than the location of an existing
     // extension, let the update process overwrite the existing extension.
   } else {
-    if (ExtensionPrefs::Get(context_)->IsExternalExtensionUninstalled(id))
+    // Skip the installation if the extension was removed by the user and it's
+    // not specified to be force-installed through the policy.
+    if (!Manifest::IsPolicyLocation(location) &&
+        ExtensionPrefs::Get(context_)->IsExternalExtensionUninstalled(id)) {
       return false;
+    }
 
     if (extension) {
       LOG(DFATAL) << "Trying to add extension " << id