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

Side by Side Diff: extensions/browser/api/declarative/declarative_api.cc

Issue 1158693006: Create a mechanism define declarative rules via the extension manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
OLDNEW
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 "extensions/browser/api/declarative/declarative_api.h" 5 #include "extensions/browser/api/declarative/declarative_api.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 return true; 165 return true;
166 } 166 }
167 167
168 bool EventsEventAddRulesFunction::RunAsyncOnCorrectThread() { 168 bool EventsEventAddRulesFunction::RunAsyncOnCorrectThread() {
169 ConvertBinaryListElementsToBase64(args_.get()); 169 ConvertBinaryListElementsToBase64(args_.get());
170 scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_)); 170 scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_));
171 EXTENSION_FUNCTION_VALIDATE(params.get()); 171 EXTENSION_FUNCTION_VALIDATE(params.get());
172 172
173 error_ = rules_registry_->AddRules(extension_id(), params->rules); 173 error_ = rules_registry_->AddRules(extension_id(), params->rules, false);
174 174
175 if (error_.empty()) 175 if (error_.empty())
176 results_ = AddRules::Results::Create(params->rules); 176 results_ = AddRules::Results::Create(params->rules);
177 177
178 return error_.empty(); 178 return error_.empty();
179 } 179 }
180 180
181 bool EventsEventRemoveRulesFunction::RunAsyncOnCorrectThread() { 181 bool EventsEventRemoveRulesFunction::RunAsyncOnCorrectThread() {
182 scoped_ptr<RemoveRules::Params> params(RemoveRules::Params::Create(*args_)); 182 scoped_ptr<RemoveRules::Params> params(RemoveRules::Params::Create(*args_));
183 EXTENSION_FUNCTION_VALIDATE(params.get()); 183 EXTENSION_FUNCTION_VALIDATE(params.get());
(...skipping 19 matching lines...) Expand all
203 } else { 203 } else {
204 rules_registry_->GetAllRules(extension_id(), &rules); 204 rules_registry_->GetAllRules(extension_id(), &rules);
205 } 205 }
206 206
207 results_ = GetRules::Results::Create(rules); 207 results_ = GetRules::Results::Create(rules);
208 208
209 return true; 209 return true;
210 } 210 }
211 211
212 } // namespace extensions 212 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698