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 // Implementation of the Chrome Extensions Managed Mode API. | 5 // Implementation of the Chrome Extensions Managed Mode API. |
6 | 6 |
7 #include "chrome/browser/extensions/extension_managed_mode_api.h" | 7 #include "chrome/browser/extensions/extension_managed_mode_api.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name); | 59 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name); |
60 | 60 |
61 ListValue args; | 61 ListValue args; |
62 DictionaryValue* dict = new DictionaryValue(); | 62 DictionaryValue* dict = new DictionaryValue(); |
63 args.Append(dict); | 63 args.Append(dict); |
64 dict->SetBoolean(extension_preference_api_constants::kValue, | 64 dict->SetBoolean(extension_preference_api_constants::kValue, |
65 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); | 65 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); |
66 std::string json_args; | 66 std::string json_args; |
67 base::JSONWriter::Write(&args, &json_args); | 67 base::JSONWriter::Write(&args, &json_args); |
68 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter(); | 68 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter(); |
69 event_router->DispatchEventToRenderers(kChangeEventName, json_args, | 69 event_router->DispatchEventToRenderers(kChangeEventName, json_args, NULL, |
70 NULL, GURL()); | 70 GURL(), |
| 71 extensions::EventFilteringInfo()); |
71 } | 72 } |
72 | 73 |
73 GetManagedModeFunction::~GetManagedModeFunction() { } | 74 GetManagedModeFunction::~GetManagedModeFunction() { } |
74 | 75 |
75 bool GetManagedModeFunction::RunImpl() { | 76 bool GetManagedModeFunction::RunImpl() { |
76 bool in_managed_mode = ManagedMode::IsInManagedMode(); | 77 bool in_managed_mode = ManagedMode::IsInManagedMode(); |
77 | 78 |
78 scoped_ptr<DictionaryValue> result(new DictionaryValue); | 79 scoped_ptr<DictionaryValue> result(new DictionaryValue); |
79 result->SetBoolean(keys::kValue, in_managed_mode); | 80 result->SetBoolean(keys::kValue, in_managed_mode); |
80 result_.reset(result.release()); | 81 result_.reset(result.release()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &key)); | 120 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &key)); |
120 base::Value* value = NULL; | 121 base::Value* value = NULL; |
121 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); | 122 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); |
122 #if defined(ENABLE_CONFIGURATION_POLICY) | 123 #if defined(ENABLE_CONFIGURATION_POLICY) |
123 policy::ManagedModePolicyProvider* policy_provider = | 124 policy::ManagedModePolicyProvider* policy_provider = |
124 ManagedModePolicyProviderFactory::GetForProfile(profile_); | 125 ManagedModePolicyProviderFactory::GetForProfile(profile_); |
125 policy_provider->SetPolicy(key, value); | 126 policy_provider->SetPolicy(key, value); |
126 #endif | 127 #endif |
127 return true; | 128 return true; |
128 } | 129 } |
OLD | NEW |