Commit 24813018 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Cleanup] Remove ExecuteCodeFunction::resource_ member

It's only used in a single method. Just make it a function-local.

Bug: None
Change-Id: I0ebcc1f9a6ff8d724490e2e41aa7c4fe35096f86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518196
Auto-Submit: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824809}
parent c46fbad8
......@@ -14,6 +14,7 @@
#include "extensions/browser/load_and_localize_file.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
namespace {
......@@ -165,8 +166,8 @@ ExtensionFunction::ResponseAction ExecuteCodeFunction::Run() {
bool ExecuteCodeFunction::LoadFile(const std::string& file,
std::string* error) {
resource_ = extension()->GetResource(file);
if (resource_.extension_root().empty() || resource_.relative_path().empty()) {
ExtensionResource resource = extension()->GetResource(file);
if (resource.extension_root().empty() || resource.relative_path().empty()) {
*error = kNoCodeOrFileToExecuteError;
return false;
}
......@@ -178,9 +179,9 @@ bool ExecuteCodeFunction::LoadFile(const std::string& file,
(ShouldInsertCSS() || ShouldRemoveCSS()) && !extension()->id().empty();
LoadAndLocalizeResource(
*extension(), resource_, might_require_localization,
*extension(), resource, might_require_localization,
base::BindOnce(&ExecuteCodeFunction::DidLoadAndLocalizeFile, this,
resource_.relative_path().AsUTF8Unsafe()));
resource.relative_path().AsUTF8Unsafe()));
return true;
}
......
......@@ -88,10 +88,6 @@ class ExecuteCodeFunction : public ExtensionFunction {
// failure and sets |error|.
bool Execute(const std::string& code_string, std::string* error);
// Contains extension resource built from path of file which is
// specified in JSON arguments.
ExtensionResource resource_;
// The URL of the file being injected into the page, in the
// chrome-extension: scheme.
GURL script_url_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment