Commit fded23c6 authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Replaced all occurrences of DLOG with DVLOG.

Since most existing LOGs were only used for reporting fatal errors, most DVLOGs currently use verbosity 1.

Bug: 806868
Change-Id: Ie5819d88975daf8e2a9e8169843b6d39d7fa365b
Reviewed-on: https://chromium-review.googlesource.com/c/1449680
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Reviewed-by: default avatarStephane Zermatten <szermatt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629983}
parent 337ba2cc
......@@ -136,7 +136,7 @@ void PromptAction::OnSuggestionChosen(const std::string& payload) {
batch_element_checker_.reset();
PromptProto::Choice choice;
if (!choice.ParseFromString(payload)) {
DLOG(ERROR) << "Invalid result.";
DVLOG(1) << "Invalid result.";
UpdateProcessedAction(OTHER_ACTION_STATUS);
} else {
UpdateProcessedAction(ACTION_APPLIED);
......
......@@ -83,7 +83,7 @@ void SetFormFieldValueAction::OnSetFieldValue(ActionDelegate* delegate,
weak_ptr_factory_.GetWeakPtr(), delegate,
std::move(callback), /* next = */ next + 1));
} else {
DLOG(ERROR)
DVLOG(3)
<< "SetFormFieldValueProto_KeyPress: field `keycode' is deprecated "
<< "and only supports US-ASCII values (encountered "
<< key_field.keycode() << "). Use field `key' instead.";
......@@ -99,7 +99,7 @@ void SetFormFieldValueAction::OnSetFieldValue(ActionDelegate* delegate,
std::move(callback), /* next = */ next + 1));
break;
default:
DLOG(ERROR) << "Unrecognized field for SetFormFieldValueProto_KeyPress";
DVLOG(1) << "Unrecognized field for SetFormFieldValueProto_KeyPress";
OnSetFieldValue(delegate, std::move(callback), next, /* status= */ false);
break;
}
......
......@@ -272,7 +272,7 @@ void Controller::OnGetScripts(const GURL& url,
return;
if (!result) {
LOG(ERROR) << "Failed to get assistant scripts for URL " << url.spec();
DVLOG(1) << "Failed to get assistant scripts for URL " << url.spec();
// TODO(crbug.com/806868): Terminate Autofill Assistant.
return;
}
......@@ -307,7 +307,7 @@ void Controller::ExecuteScript(const std::string& script_path) {
void Controller::OnScriptExecuted(const std::string& script_path,
const ScriptExecutor::Result& result) {
if (!result.success) {
LOG(ERROR) << "Failed to execute script " << script_path;
DVLOG(1) << "Failed to execute script " << script_path;
OnFatalError(l10n_util::GetStringUTF8(IDS_AUTOFILL_ASSISTANT_DEFAULT_ERROR),
Metrics::SCRIPT_FAILED);
return;
......@@ -351,7 +351,7 @@ void Controller::OnScriptExecuted(const std::string& script_path,
break;
default:
DLOG(ERROR) << "Unexpected value for at_end: " << result.at_end;
DVLOG(1) << "Unexpected value for at_end: " << result.at_end;
break;
}
EnterState(AutofillAssistantState::PROMPT);
......@@ -360,6 +360,9 @@ void Controller::OnScriptExecuted(const std::string& script_path,
void Controller::OnFatalError(const std::string& error_message,
Metrics::DropOutReason reason) {
LOG(ERROR) << "Autofill Assistant has encountered an error and is shutting "
"down. Reason: "
<< static_cast<int>(reason);
if (state_ == AutofillAssistantState::STOPPED)
return;
......
......@@ -263,8 +263,8 @@ bool ProtocolUtils::ParseActions(const std::string& response,
}
default:
case ActionProto::ActionInfoCase::ACTION_INFO_NOT_SET: {
DLOG(ERROR) << "Unknown or unsupported action with action_case="
<< action.action_info_case();
DVLOG(1) << "Unknown or unsupported action with action_case="
<< action.action_info_case();
actions->emplace_back(std::make_unique<UnsupportedAction>(action));
break;
}
......
......@@ -24,9 +24,8 @@ std::unique_ptr<ScriptPrecondition> ScriptPrecondition::FromProto(
// TODO(crbug.com/806868): Check if we shouldn't skip the script when this
// happens.
if (element.selectors_size() == 0) {
DLOG(WARNING)
<< "Empty selectors in script precondition for script path: "
<< script_path << ".";
DVLOG(3) << "Empty selectors in script precondition for script path: "
<< script_path << ".";
continue;
}
......@@ -42,8 +41,8 @@ std::unique_ptr<ScriptPrecondition> ScriptPrecondition::FromProto(
for (const auto& pattern : script_precondition_proto.path_pattern()) {
auto re = std::make_unique<re2::RE2>(pattern);
if (re->error_code() != re2::RE2::NoError) {
DLOG(ERROR) << "Invalid regexp in script precondition '" << pattern
<< "' for script path: " << script_path << ".";
DVLOG(1) << "Invalid regexp in script precondition '" << pattern
<< "' for script path: " << script_path << ".";
return nullptr;
}
path_pattern.emplace_back(std::move(re));
......
......@@ -108,8 +108,8 @@ void ScriptTracker::CheckScripts(const base::TimeDelta& max_duration) {
void ScriptTracker::ExecuteScript(const std::string& script_path,
ScriptExecutor::RunScriptCallback callback) {
if (running()) {
DLOG(ERROR) << "Do not expect executing the script (" << script_path
<< " when there is a script running.";
DVLOG(1) << "Do not expect executing the script (" << script_path
<< " when there is a script running.";
ScriptExecutor::Result result;
result.success = false;
std::move(callback).Run(result);
......
......@@ -253,7 +253,7 @@ void WebController::ElementPositionGetter::GetAndWaitBoxModelStable() {
void WebController::ElementPositionGetter::OnGetBoxModelForStableCheck(
std::unique_ptr<dom::GetBoxModelResult> result) {
if (!result || !result->GetModel() || !result->GetModel()->GetContent()) {
DLOG(ERROR) << "Failed to get box model.";
DVLOG(1) << "Failed to get box model.";
OnError();
return;
}
......@@ -324,7 +324,7 @@ void WebController::ElementPositionGetter::OnGetBoxModelForStableCheck(
void WebController::ElementPositionGetter::OnScrollIntoView(
std::unique_ptr<runtime::CallFunctionOnResult> result) {
if (!result || result->HasExceptionDetails()) {
DLOG(ERROR) << "Failed to scroll the element.";
DVLOG(1) << "Failed to scroll the element.";
OnError();
return;
}
......@@ -415,7 +415,7 @@ void WebController::OnFindElementForClickOrTap(
std::unique_ptr<FindElementResult> result) {
// Found element must belong to a frame.
if (!result->container_frame_host || result->object_id.empty()) {
DLOG(ERROR) << "Failed to find the element to click or tap.";
DVLOG(1) << "Failed to find the element to click or tap.";
OnResult(false, std::move(callback));
return;
}
......@@ -449,7 +449,7 @@ void WebController::OnScrollIntoView(
bool is_a_click,
std::unique_ptr<runtime::CallFunctionOnResult> result) {
if (!result || result->HasExceptionDetails()) {
DLOG(ERROR) << "Failed to scroll the element.";
DVLOG(1) << "Failed to scroll the element.";
OnResult(false, std::move(callback));
return;
}
......@@ -472,7 +472,7 @@ void WebController::TapOrClickOnCoordinates(
int x,
int y) {
if (!has_coordinates) {
DLOG(ERROR) << "Failed to get element position.";
DVLOG(1) << "Failed to get element position.";
OnResult(false, std::move(callback));
return;
}
......@@ -511,7 +511,7 @@ void WebController::OnDispatchPressMouseEvent(
int y,
std::unique_ptr<input::DispatchMouseEventResult> result) {
if (!result) {
DLOG(ERROR) << "Failed to dispatch mouse left button pressed event.";
DVLOG(1) << "Failed to dispatch mouse left button pressed event.";
OnResult(false, std::move(callback));
return;
}
......@@ -538,7 +538,7 @@ void WebController::OnDispatchTouchEventStart(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<input::DispatchTouchEventResult> result) {
if (!result) {
DLOG(ERROR) << "Failed to dispatch touch start event.";
DVLOG(1) << "Failed to dispatch touch start event.";
OnResult(false, std::move(callback));
return;
}
......@@ -621,7 +621,7 @@ void WebController::OnGetDocumentElement(
element_result->container_frame_selector_index = 0;
element_result->object_id = "";
if (!result || !result->GetResult() || !result->GetResult()->HasObjectId()) {
DLOG(ERROR) << "Failed to get document root element.";
DVLOG(1) << "Failed to get document root element.";
std::move(callback).Run(std::move(element_result));
return;
}
......@@ -716,7 +716,7 @@ void WebController::OnDescribeNodeForPseudoElement(
FindElementCallback callback,
std::unique_ptr<dom::DescribeNodeResult> result) {
if (!result || !result->GetNode()) {
DLOG(ERROR) << "Failed to describe the node for pseudo element.";
DVLOG(1) << "Failed to describe the node for pseudo element.";
std::move(callback).Run(std::move(element_result));
return;
}
......@@ -762,7 +762,7 @@ void WebController::OnDescribeNode(
FindElementCallback callback,
std::unique_ptr<dom::DescribeNodeResult> result) {
if (!result || !result->GetNode()) {
DLOG(ERROR) << "Failed to describe the node.";
DVLOG(1) << "Failed to describe the node.";
std::move(callback).Run(std::move(element_result));
return;
}
......@@ -793,13 +793,13 @@ void WebController::OnDescribeNode(
element_result->container_frame_host = FindCorrespondingRenderFrameHost(
frame_name, node->GetContentDocument()->GetDocumentURL());
if (!element_result->container_frame_host) {
DLOG(ERROR) << "Failed to find corresponding owner frame.";
DVLOG(1) << "Failed to find corresponding owner frame.";
std::move(callback).Run(std::move(element_result));
return;
}
} else if (node->HasFrameId()) {
// TODO(crbug.com/806868): Support out-of-process iframe.
DLOG(WARNING) << "The element is inside an OOPIF.";
DVLOG(3) << "Warning (unsupported): the element is inside an OOPIF.";
std::move(callback).Run(std::move(element_result));
return;
}
......@@ -834,7 +834,7 @@ void WebController::OnResolveNode(
FindElementCallback callback,
std::unique_ptr<dom::ResolveNodeResult> result) {
if (!result || !result->GetObject() || !result->GetObject()->HasObjectId()) {
DLOG(ERROR) << "Failed to resolve object id from backend id.";
DVLOG(1) << "Failed to resolve object id from backend id.";
std::move(callback).Run(std::move(element_result));
return;
}
......@@ -875,7 +875,7 @@ void WebController::OnFindElementForFocusElement(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<FindElementResult> element_result) {
if (element_result->object_id.empty()) {
DLOG(ERROR) << "Failed to find the element to focus on.";
DVLOG(1) << "Failed to find the element to focus on.";
OnResult(false, std::move(callback));
return;
}
......@@ -899,7 +899,7 @@ void WebController::OnFocusElement(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<runtime::CallFunctionOnResult> result) {
if (!result || result->HasExceptionDetails()) {
DLOG(ERROR) << "Failed to focus on element.";
DVLOG(1) << "Failed to focus on element.";
OnResult(false, std::move(callback));
return;
}
......@@ -926,7 +926,7 @@ void WebController::OnFindElementForFillingForm(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<FindElementResult> element_result) {
if (element_result->object_id.empty()) {
DLOG(ERROR) << "Failed to find the element for filling the form.";
DVLOG(1) << "Failed to find the element for filling the form.";
OnResult(false, std::move(callback));
return;
}
......@@ -952,7 +952,7 @@ void WebController::OnGetFormAndFieldDataForFillingForm(
const autofill::FormData& form_data,
const autofill::FormFieldData& form_field) {
if (form_data.fields.empty()) {
DLOG(ERROR) << "Failed to get form data to fill form.";
DVLOG(1) << "Failed to get form data to fill form.";
OnResult(false, std::move(callback));
return;
}
......@@ -960,7 +960,7 @@ void WebController::OnGetFormAndFieldDataForFillingForm(
ContentAutofillDriver* driver =
ContentAutofillDriver::GetForRenderFrameHost(container_frame_host);
if (!driver) {
DLOG(ERROR) << "Failed to get the autofill driver.";
DVLOG(1) << "Failed to get the autofill driver.";
OnResult(false, std::move(callback));
return;
}
......@@ -1008,7 +1008,7 @@ void WebController::OnFindElementForSelectOption(
std::unique_ptr<FindElementResult> element_result) {
const std::string object_id = element_result->object_id;
if (object_id.empty()) {
DLOG(ERROR) << "Failed to find the element to select an option.";
DVLOG(1) << "Failed to find the element to select an option.";
OnResult(false, std::move(callback));
return;
}
......@@ -1033,7 +1033,7 @@ void WebController::OnSelectOption(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<runtime::CallFunctionOnResult> result) {
if (!result || result->HasExceptionDetails()) {
DLOG(ERROR) << "Failed to select option.";
DVLOG(1) << "Failed to select option.";
OnResult(false, std::move(callback));
return;
}
......@@ -1057,7 +1057,7 @@ void WebController::OnFindElementForHighlightElement(
std::unique_ptr<FindElementResult> element_result) {
const std::string object_id = element_result->object_id;
if (object_id.empty()) {
DLOG(ERROR) << "Failed to find the element to highlight.";
DVLOG(1) << "Failed to find the element to highlight.";
OnResult(false, std::move(callback));
return;
}
......@@ -1080,7 +1080,7 @@ void WebController::OnHighlightElement(
base::OnceCallback<void(bool)> callback,
std::unique_ptr<runtime::CallFunctionOnResult> result) {
if (!result || result->HasExceptionDetails()) {
DLOG(ERROR) << "Failed to highlight element.";
DVLOG(1) << "Failed to highlight element.";
OnResult(false, std::move(callback));
return;
}
......@@ -1153,7 +1153,7 @@ void WebController::SetFieldValue(const Selector& selector,
wchar_t wide_char = iter.get();
std::string utf8_char;
if (!base::WideToUTF8(&wide_char, 1, &utf8_char)) {
DLOG(ERROR) << "Failed to convert character to UTF-8: " << wide_char;
DVLOG(1) << "Failed to convert character to UTF-8: " << wide_char;
OnResult(false, std::move(callback));
return;
}
......
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