Commit c57807b5 authored by anthonyvd's avatar anthonyvd Committed by Commit Bot

Revert "[Autofill Assistant] Add ShowProgressBar action."

This reverts commit bb70008e.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [Autofill Assistant] Add ShowProgressBar action.
> 
> Screenshot: https://screenshot.googleplex.com/chZ1byvKBqa.png
> 
> Bug: 806868
> Change-Id: Ib7714b1b554d030c461614bcd51cc30156cac594
> Reviewed-on: https://chromium-review.googlesource.com/c/1278808
> Reviewed-by: Theresa <twellington@chromium.org>
> Reviewed-by: Ganggui Tang <gogerald@chromium.org>
> Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#600015}

TBR=twellington@chromium.org,gogerald@chromium.org,lsuder@google.com,jdemeulenaere@chromium.org

Change-Id: I56cf273550bc82f36e2eb1e3cafaedfd935f6c45
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 806868
Reviewed-on: https://chromium-review.googlesource.com/c/1284067Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600069}
parent 8b202143
......@@ -76,19 +76,10 @@
android:contentDescription="@string/close" />
</LinearLayout>
<org.chromium.chrome.browser.widget.MaterialProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="4dp"
app:colorBackground="@color/modern_grey_300"
app:colorProgress="@color/modern_blue_600"
android:visibility="invisible" />
<RelativeLayout
android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="@dimen/autofill_assistant_details_image_size"
android:layout_marginTop="8dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="8dp"
......
......@@ -237,16 +237,6 @@ public class AutofillAssistantUiController implements AutofillAssistantUiDelegat
new AutofillAssistantUiDelegate.Details(title, url, date, description));
}
@CalledByNative
private void onShowProgressBar(int progress, String message) {
mUiDelegate.showProgressBar(progress, message);
}
@CalledByNative
private void onHideProgressBar() {
mUiDelegate.hideProgressBar();
}
// native methods.
private native long nativeInit(
WebContents webContents, String[] parameterNames, String[] parameterValues);
......
......@@ -28,7 +28,6 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.widget.MaterialProgressBar;
import java.io.InputStream;
import java.net.URL;
......@@ -56,7 +55,6 @@ class AutofillAssistantUiDelegate {
private final LinearLayout mBottomBar;
private final ViewGroup mChipsViewContainer;
private final TextView mStatusMessageView;
private final MaterialProgressBar mProgressBar;
private final ViewGroup mDetails;
private final AppCompatImageView mDetailsImage;
......@@ -191,7 +189,6 @@ class AutofillAssistantUiDelegate {
FEEDBACK_CATEGORY_TAG));
mChipsViewContainer = mBottomBar.findViewById(R.id.carousel);
mStatusMessageView = mBottomBar.findViewById(R.id.status_message);
mProgressBar = mBottomBar.findViewById(R.id.progress_bar);
mDetails = (ViewGroup) mBottomBar.findViewById(R.id.details);
mDetailsImage = (AppCompatImageView) mDetails.findViewById(R.id.details_image);
......@@ -332,21 +329,6 @@ class AutofillAssistantUiDelegate {
return roundedBitmap;
}
public void showProgressBar(int progress, String message) {
ensureFullContainerIsShown();
// TODO(crbug.com/806868): Animate the progress change.
mProgressBar.setProgress(progress);
mProgressBar.setVisibility(View.VISIBLE);
if (!message.isEmpty()) {
mStatusMessageView.setText(message);
}
}
public void hideProgressBar() {
mProgressBar.setVisibility(View.INVISIBLE);
}
/**
* Shuts down the Autofill Assistant. The UI disappears and any associated state goes away.
*/
......
......@@ -239,20 +239,6 @@ void UiControllerAndroid::ShowDetails(const DetailsProto& details) {
month, day, hour, minute, second);
}
void UiControllerAndroid::ShowProgressBar(int progress,
const std::string& message) {
JNIEnv* env = AttachCurrentThread();
Java_AutofillAssistantUiController_onShowProgressBar(
env, java_autofill_assistant_ui_controller_, progress,
base::android::ConvertUTF8ToJavaString(env, message));
}
void UiControllerAndroid::HideProgressBar() {
JNIEnv* env = AttachCurrentThread();
Java_AutofillAssistantUiController_onHideProgressBar(
env, java_autofill_assistant_ui_controller_);
}
std::string UiControllerAndroid::GetApiKey() {
std::string api_key;
if (google_apis::IsGoogleChromeAPIKeyUsed()) {
......
......@@ -42,8 +42,6 @@ class UiControllerAndroid : public UiController, public Client {
override;
void HideDetails() override;
void ShowDetails(const DetailsProto& details) override;
void ShowProgressBar(int progress, const std::string& message) override;
void HideProgressBar() override;
// Overrides Client:
std::string GetApiKey() override;
......
......@@ -34,8 +34,6 @@ jumbo_static_library("browser") {
"actions/select_option_action.h",
"actions/show_details_action.cc",
"actions/show_details_action.h",
"actions/show_progress_bar_action.cc",
"actions/show_progress_bar_action.h",
"actions/stop_action.cc",
"actions/stop_action.h",
"actions/tell_action.cc",
......
......@@ -143,12 +143,6 @@ class ActionDelegate {
// Show contextual information.
virtual void ShowDetails(const DetailsProto& details) = 0;
// Show the progress bar with |message| and set it at |progress|%.
virtual void ShowProgressBar(int progress, const std::string& message) = 0;
// Hide the progress bar.
virtual void HideProgressBar();
protected:
ActionDelegate() = default;
};
......
......@@ -116,8 +116,6 @@ class MockActionDelegate : public ActionDelegate {
MOCK_METHOD1(StopCurrentScript, void(const std::string& message));
MOCK_METHOD0(HideDetails, void());
MOCK_METHOD1(ShowDetails, void(const DetailsProto& details));
MOCK_METHOD2(ShowProgressBar, void(int progress, const std::string& message));
MOCK_METHOD0(HideProgressBar, void());
};
} // namespace autofill_assistant
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/autofill_assistant/browser/actions/show_progress_bar_action.h"
#include "base/bind.h"
#include "base/callback.h"
#include "components/autofill_assistant/browser/actions/action_delegate.h"
namespace autofill_assistant {
ShowProgressBarAction::ShowProgressBarAction(const ActionProto& proto)
: Action(proto) {
DCHECK(proto_.has_show_progress_bar());
}
ShowProgressBarAction::~ShowProgressBarAction() {}
void ShowProgressBarAction::ProcessAction(ActionDelegate* delegate,
ProcessActionCallback callback) {
int progress =
std::min(100, std::max(0, proto_.show_progress_bar().progress()));
if (proto_.show_progress_bar().done() || progress == 100) {
delegate->HideProgressBar();
} else {
delegate->ShowProgressBar(progress, proto_.show_progress_bar().message());
}
processed_action_proto_ = std::make_unique<ProcessedActionProto>();
UpdateProcessedAction(ACTION_APPLIED);
std::move(callback).Run(std::move(processed_action_proto_));
}
} // namespace autofill_assistant
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_SHOW_PROGRESS_BAR_ACTION_H_
#define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_SHOW_PROGRESS_BAR_ACTION_H_
#include "components/autofill_assistant/browser/actions/action.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
namespace autofill_assistant {
// An action to show the current progress.
class ShowProgressBarAction : public Action {
public:
explicit ShowProgressBarAction(const ActionProto& proto);
~ShowProgressBarAction() override;
// Overrides Action:
void ProcessAction(ActionDelegate* delegate,
ProcessActionCallback callback) override;
private:
DISALLOW_COPY_AND_ASSIGN(ShowProgressBarAction);
};
} // namespace autofill_assistant
#endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_SHOW_PROGRESS_BAR_ACTION_H_
......@@ -47,8 +47,6 @@ class MockUiController : public UiController {
callback));
MOCK_METHOD0(HideDetails, void());
MOCK_METHOD1(ShowDetails, void(const DetailsProto& details));
MOCK_METHOD2(ShowProgressBar, void(int progress, const std::string& message));
MOCK_METHOD0(HideProgressBar, void());
};
} // namespace autofill_assistant
......
......@@ -16,7 +16,6 @@
#include "components/autofill_assistant/browser/actions/reset_action.h"
#include "components/autofill_assistant/browser/actions/select_option_action.h"
#include "components/autofill_assistant/browser/actions/show_details_action.h"
#include "components/autofill_assistant/browser/actions/show_progress_bar_action.h"
#include "components/autofill_assistant/browser/actions/stop_action.h"
#include "components/autofill_assistant/browser/actions/tell_action.h"
#include "components/autofill_assistant/browser/actions/unsupported_action.h"
......@@ -212,10 +211,6 @@ bool ProtocolUtils::ParseActions(
std::make_unique<GetPaymentInformationAction>(action));
break;
}
case ActionProto::ActionInfoCase::kShowProgressBar: {
actions->emplace_back(std::make_unique<ShowProgressBarAction>(action));
break;
}
default:
case ActionProto::ActionInfoCase::ACTION_INFO_NOT_SET: {
DLOG(ERROR) << "Unknown or unsupported action with action_case="
......
......@@ -137,14 +137,6 @@ void ScriptExecutor::FocusElement(const std::vector<std::string>& selectors,
delegate_->GetWebController()->FocusElement(selectors, std::move(callback));
}
void ScriptExecutor::ShowProgressBar(int progress, const std::string& message) {
delegate_->GetUiController()->ShowProgressBar(progress, message);
}
void ScriptExecutor::HideProgressBar() {
delegate_->GetUiController()->HideProgressBar();
}
void ScriptExecutor::SetFieldValue(const std::vector<std::string>& selectors,
const std::string& value,
base::OnceCallback<void(bool)> callback) {
......
......@@ -97,8 +97,6 @@ class ScriptExecutor : public ActionDelegate {
void StopCurrentScript(const std::string& message) override;
void HideDetails() override;
void ShowDetails(const DetailsProto& details) override;
void ShowProgressBar(int progress, const std::string& message) override;
void HideProgressBar() override;
private:
void OnGetActions(bool result, const std::string& response);
......
......@@ -199,7 +199,6 @@ message ActionProto {
UseCreditCardProto use_card = 28;
UseAddressProto use_address = 29;
UploadDomProto upload_dom = 18;
ShowProgressBarProto show_progress_bar = 24;
HighlightElementProto highlight_element = 31;
ShowDetailsProto show_details = 32;
ResetProto reset = 34;
......@@ -348,20 +347,6 @@ message UploadDomProto {
optional ElementReferenceProto tree_root = 1;
}
// Shows the progress bar.
message ShowProgressBarProto {
// Specifies whether the progress is done and should be removed.
optional bool done = 2;
// Message to show on the progress bar while loading.
optional string message = 3;
// Value between 0 and 100 indicating the current progress. Values above 100
// will be capped to 100, values below 0 will be capped to 0 by the client.
// NOTE: Setting |progress| to 100 is an equivalent of setting |done| to true.
optional int32 progress = 6;
}
// Contain all arguments to perform a highlight element action.
message HighlightElementProto {
// The element to highlight.
......
......@@ -72,12 +72,6 @@ class UiController {
// Show contextual information.
virtual void ShowDetails(const DetailsProto& details) = 0;
// Show the progress bar with |message| and set it at |progress|%.
virtual void ShowProgressBar(int progress, const std::string& message) = 0;
// Hide the progress bar.
virtual void HideProgressBar();
protected:
UiController() = default;
};
......
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