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

Side by Side Diff: chrome/common/extensions/manifest_handlers/kiosk_enabled_info.cc

Issue 23604068: Add "kiosk_only" manifest attribute for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed .crx binary Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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/common/extensions/manifest_handlers/kiosk_enabled_info.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h"
12 #include "extensions/common/manifest_constants.h"
13
14 namespace extensions {
15
16 namespace keys = manifest_keys;
17
18 KioskEnabledInfo::KioskEnabledInfo(bool is_kiosk_enabled)
19 : kiosk_enabled(is_kiosk_enabled) {
20 }
21
22 KioskEnabledInfo::~KioskEnabledInfo() {
23 }
24
25 // static
26 bool KioskEnabledInfo::IsKioskEnabled(const Extension* extension) {
27 KioskEnabledInfo* info = static_cast<KioskEnabledInfo*>(
28 extension->GetManifestData(keys::kKioskEnabled));
29 return info ? info->kiosk_enabled : false;
30 }
31
32 KioskEnabledHandler::KioskEnabledHandler() {
33 }
34
35 KioskEnabledHandler::~KioskEnabledHandler() {
36 }
37
38 bool KioskEnabledHandler::Parse(Extension* extension, string16* error) {
39 DCHECK(extension->manifest()->HasKey(keys::kKioskEnabled));
40
41 bool kiosk_enabled = false;
42 if (!extension->manifest()->GetBoolean(keys::kKioskEnabled, &kiosk_enabled)) {
43 *error = ASCIIToUTF16(manifest_errors::kInvalidKioskEnabled);
44 return false;
45 }
46
47 // All other use cases should be already filtered out by manifest feature
48 // checks.
49 DCHECK(extension->is_platform_app());
50
51 extension->SetManifestData(keys::kKioskEnabled,
52 new KioskEnabledInfo(kiosk_enabled));
53 return true;
54 }
55
56 const std::vector<std::string> KioskEnabledHandler::Keys() const {
57 return SingleKey(keys::kKioskEnabled);
58 }
59
60 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698