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

Unified Diff: chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc

Issue 1150373002: platformKeys: Add policy and corporate key tagging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@key_perm
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc
index 56521569cca64d517cc0a0fd4472be830f1e3e8c..101e0c854564af5e38408cb5398059f2aecf56d8 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/platform_keys_certificate_selector_chromeos.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_registry.h"
@@ -25,24 +26,6 @@
namespace chromeos {
namespace {
-// This SelectDelegate always selects no certificate.
-class NoOpSelectDelegate
- : public chromeos::PlatformKeysService::SelectDelegate {
- public:
- NoOpSelectDelegate() {}
-
- void Select(const std::string& extension_id,
- const net::CertificateList& certs,
- const CertificateSelectedCallback& callback,
- content::WebContents* web_contents,
- content::BrowserContext* context) override {
- callback.Run(nullptr);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NoOpSelectDelegate);
-};
-
// This delegate selects a certificate by showing the certificate selection
// dialog to the user.
class DefaultSelectDelegate
@@ -103,6 +86,7 @@ PlatformKeysServiceFactory::PlatformKeysServiceFactory()
"PlatformKeysService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(extensions::ExtensionSystemFactory::GetInstance());
+ DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance());
}
PlatformKeysServiceFactory::~PlatformKeysServiceFactory() {
@@ -118,19 +102,19 @@ KeyedService* PlatformKeysServiceFactory::BuildServiceInstanceFor(
extensions::StateStore* const store =
extensions::ExtensionSystem::Get(context)->state_store();
DCHECK(store);
- PlatformKeysService* const service = new PlatformKeysService(context, store);
- policy::ProfilePolicyConnector* const connector =
+ policy::ProfilePolicyConnector* const policy_connector =
policy::ProfilePolicyConnectorFactory::GetForBrowserContext(context);
- // Only allow the user to grant certificate permissions to extensions if the
- // user is not managed by policy. Otherwise the user might leak access to
- // (private keys of) certificates against the intentions of the administrator.
- // TODO(pneubeck): Remove this once the respective policy is implemented.
- // https://crbug.com/460232
- if (connector->IsManaged())
- service->SetSelectDelegate(make_scoped_ptr(new NoOpSelectDelegate()));
- else
- service->SetSelectDelegate(make_scoped_ptr(new DefaultSelectDelegate()));
+
+ Profile* const profile = Profile::FromBrowserContext(context);
+
+ LOG(ERROR) << "context " << context << " connector " << policy_connector << " managed "
+ << policy_connector->IsManaged();
+ PlatformKeysService* const service = new PlatformKeysService(
+ profile->GetPrefs(), policy_connector->IsManaged(),
+ policy_connector->policy_service(), context, store);
+
+ service->SetSelectDelegate(make_scoped_ptr(new DefaultSelectDelegate()));
return service;
}

Powered by Google App Engine
This is Rietveld 408576698