OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/extensions/echo_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 chromeos::system::StatisticsProvider::GetInstance(); | 27 chromeos::system::StatisticsProvider::GetInstance(); |
28 std::string result; | 28 std::string result; |
29 if (!chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | 29 if (!chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { |
30 // In Kiosk mode, we effectively disable the registration API | 30 // In Kiosk mode, we effectively disable the registration API |
31 // by always returning an empty code. | 31 // by always returning an empty code. |
32 if (type == kCouponType) | 32 if (type == kCouponType) |
33 provider->GetMachineStatistic(kCouponCodeKey, &result); | 33 provider->GetMachineStatistic(kCouponCodeKey, &result); |
34 else if (type == kGroupType) | 34 else if (type == kGroupType) |
35 provider->GetMachineStatistic(kGroupCodeKey, &result); | 35 provider->GetMachineStatistic(kGroupCodeKey, &result); |
36 } | 36 } |
37 return Value::CreateStringValue(result); | 37 return new base::StringValue(result); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 | 42 |
43 GetRegistrationCodeFunction::GetRegistrationCodeFunction() { | 43 GetRegistrationCodeFunction::GetRegistrationCodeFunction() { |
44 } | 44 } |
45 | 45 |
46 GetRegistrationCodeFunction::~GetRegistrationCodeFunction() { | 46 GetRegistrationCodeFunction::~GetRegistrationCodeFunction() { |
47 } | 47 } |
48 | 48 |
49 bool GetRegistrationCodeFunction::RunImpl() { | 49 bool GetRegistrationCodeFunction::RunImpl() { |
50 std::string type; | 50 std::string type; |
51 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &type)); | 51 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &type)); |
52 SetResult(GetValueForRegistrationCodeType(type)); | 52 SetResult(GetValueForRegistrationCodeType(type)); |
53 return true; | 53 return true; |
54 } | 54 } |
OLD | NEW |