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

Side by Side Diff: extensions/browser/api/web_request/web_request_api.cc

Issue 2360073002: [Extensions] Isolate ExtensionFunction results_ and error_ (Closed)
Patch Set: lazyboy's Created 4 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
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/web_request/web_request_api.h" 5 #include "extensions/browser/api/web_request/web_request_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 void ClearCacheQuotaHeuristic::OnPageLoad(Bucket* bucket) { 1972 void ClearCacheQuotaHeuristic::OnPageLoad(Bucket* bucket) {
1973 callback_registered_ = false; 1973 callback_registered_ = false;
1974 bucket->DeductToken(); 1974 bucket->DeductToken();
1975 } 1975 }
1976 1976
1977 ExtensionFunction::ResponseAction 1977 ExtensionFunction::ResponseAction
1978 WebRequestInternalAddEventListenerFunction::Run() { 1978 WebRequestInternalAddEventListenerFunction::Run() {
1979 // Argument 0 is the callback, which we don't use here. 1979 // Argument 0 is the callback, which we don't use here.
1980 ExtensionWebRequestEventRouter::RequestFilter filter; 1980 ExtensionWebRequestEventRouter::RequestFilter filter;
1981 base::DictionaryValue* value = NULL; 1981 base::DictionaryValue* value = NULL;
1982 error_.clear();
1983 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &value)); 1982 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &value));
1984 // Failure + an empty error string means a fatal error. 1983 // Failure + an empty error string means a fatal error.
1985 EXTENSION_FUNCTION_VALIDATE(filter.InitFromValue(*value, &error_) || 1984 std::string error;
1986 !error_.empty()); 1985 EXTENSION_FUNCTION_VALIDATE(filter.InitFromValue(*value, &error) ||
1987 if (!error_.empty()) 1986 !error.empty());
1988 return RespondNow(Error(error_)); 1987 if (!error.empty())
1988 return RespondNow(Error(error));
1989 1989
1990 int extra_info_spec = 0; 1990 int extra_info_spec = 0;
1991 if (HasOptionalArgument(2)) { 1991 if (HasOptionalArgument(2)) {
1992 base::ListValue* value = NULL; 1992 base::ListValue* value = NULL;
1993 EXTENSION_FUNCTION_VALIDATE(args_->GetList(2, &value)); 1993 EXTENSION_FUNCTION_VALIDATE(args_->GetList(2, &value));
1994 EXTENSION_FUNCTION_VALIDATE( 1994 EXTENSION_FUNCTION_VALIDATE(
1995 ExtraInfoSpec::InitFromValue(*value, &extra_info_spec)); 1995 ExtraInfoSpec::InitFromValue(*value, &extra_info_spec));
1996 } 1996 }
1997 1997
1998 std::string event_name; 1998 std::string event_name;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 // Since EventListeners are segmented by browser_context, check that 2262 // Since EventListeners are segmented by browser_context, check that
2263 // last, as it is exceedingly unlikely to be different. 2263 // last, as it is exceedingly unlikely to be different.
2264 return extension_id == that.extension_id && 2264 return extension_id == that.extension_id &&
2265 sub_event_name == that.sub_event_name && 2265 sub_event_name == that.sub_event_name &&
2266 web_view_instance_id == that.web_view_instance_id && 2266 web_view_instance_id == that.web_view_instance_id &&
2267 embedder_process_id == that.embedder_process_id && 2267 embedder_process_id == that.embedder_process_id &&
2268 browser_context == that.browser_context; 2268 browser_context == that.browser_context;
2269 } 2269 }
2270 2270
2271 } // namespace extensions 2271 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/management/management_api_delegate.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698