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

Side by Side Diff: chrome/browser/chromeos/extensions/signin_screen_policy_provider.cc

Issue 2159103006: Add policy provider that would filter extensions/apps allowed on the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 1 month 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/extensions/signin_screen_policy_provider.h"
6
7 #include <stddef.h>
8
9 #include <cstddef>
10 #include <string>
11
12 #include "base/logging.h"
13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h"
16 #include "chrome/grit/generated_resources.h"
17 #include "extensions/common/extension.h"
18 #include "extensions/common/features/behavior_feature.h"
19 #include "extensions/common/features/feature.h"
20 #include "extensions/common/features/feature_provider.h"
21 #include "extensions/common/manifest.h"
22 #include "extensions/common/manifest_constants.h"
23 #include "ui/base/l10n/l10n_util.h"
24
25 namespace chromeos {
26
27 SigninScreenPolicyProvider::SigninScreenPolicyProvider() {}
28
29 SigninScreenPolicyProvider::~SigninScreenPolicyProvider() {}
30
31 std::string SigninScreenPolicyProvider::GetDebugPolicyProviderName() const {
32 #if defined(NDEBUG)
33 NOTREACHED();
34 return std::string();
35 #else
36 return "Guard for sign-in screen";
37 #endif
38 }
39
40 bool SigninScreenPolicyProvider::UserMayLoad(
41 const extensions::Extension* extension,
42 base::string16* error) const {
43 const extensions::Feature* feature =
44 extensions::FeatureProvider::GetBehaviorFeature(
45 extensions::BehaviorFeature::kSigninScreen);
46 CHECK(feature);
47 extensions::Feature::Availability availability =
48 feature->IsAvailableToExtension(extension);
49
50 if (availability.is_available()) {
achuithb 2016/11/11 00:36:28 nit: don't need {}
Denis Kuznetsov (DE-MUC) 2016/11/11 15:50:16 Done.
51 return true;
52 }
53 LOG(WARNING) << "Denying load of Extension : " << extension->id() << " / "
54 << extension->name() << " because of " << availability.message();
55
56 // Disallow all other extensions.
57 if (error) {
58 *error =
59 l10n_util::GetStringFUTF16(IDS_EXTENSION_CANT_INSTALL_ON_SIGNIN_SCREEN,
60 base::UTF8ToUTF16(extension->name()),
61 base::UTF8ToUTF16(extension->id()));
62 }
63 return false;
64 }
65
66 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698