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 @@ ...@@ -76,19 +76,10 @@
android:contentDescription="@string/close" /> android:contentDescription="@string/close" />
</LinearLayout> </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 <RelativeLayout
android:id="@+id/details" android:id="@+id/details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/autofill_assistant_details_image_size" android:layout_height="@dimen/autofill_assistant_details_image_size"
android:layout_marginTop="8dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
......
...@@ -237,16 +237,6 @@ public class AutofillAssistantUiController implements AutofillAssistantUiDelegat ...@@ -237,16 +237,6 @@ public class AutofillAssistantUiController implements AutofillAssistantUiDelegat
new AutofillAssistantUiDelegate.Details(title, url, date, description)); 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. // native methods.
private native long nativeInit( private native long nativeInit(
WebContents webContents, String[] parameterNames, String[] parameterValues); WebContents webContents, String[] parameterNames, String[] parameterValues);
......
...@@ -28,7 +28,6 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; ...@@ -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.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.help.HelpAndFeedback; import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.widget.MaterialProgressBar;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
...@@ -56,7 +55,6 @@ class AutofillAssistantUiDelegate { ...@@ -56,7 +55,6 @@ class AutofillAssistantUiDelegate {
private final LinearLayout mBottomBar; private final LinearLayout mBottomBar;
private final ViewGroup mChipsViewContainer; private final ViewGroup mChipsViewContainer;
private final TextView mStatusMessageView; private final TextView mStatusMessageView;
private final MaterialProgressBar mProgressBar;
private final ViewGroup mDetails; private final ViewGroup mDetails;
private final AppCompatImageView mDetailsImage; private final AppCompatImageView mDetailsImage;
...@@ -191,7 +189,6 @@ class AutofillAssistantUiDelegate { ...@@ -191,7 +189,6 @@ class AutofillAssistantUiDelegate {
FEEDBACK_CATEGORY_TAG)); FEEDBACK_CATEGORY_TAG));
mChipsViewContainer = mBottomBar.findViewById(R.id.carousel); mChipsViewContainer = mBottomBar.findViewById(R.id.carousel);
mStatusMessageView = mBottomBar.findViewById(R.id.status_message); mStatusMessageView = mBottomBar.findViewById(R.id.status_message);
mProgressBar = mBottomBar.findViewById(R.id.progress_bar);
mDetails = (ViewGroup) mBottomBar.findViewById(R.id.details); mDetails = (ViewGroup) mBottomBar.findViewById(R.id.details);
mDetailsImage = (AppCompatImageView) mDetails.findViewById(R.id.details_image); mDetailsImage = (AppCompatImageView) mDetails.findViewById(R.id.details_image);
...@@ -332,21 +329,6 @@ class AutofillAssistantUiDelegate { ...@@ -332,21 +329,6 @@ class AutofillAssistantUiDelegate {
return roundedBitmap; 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. * Shuts down the Autofill Assistant. The UI disappears and any associated state goes away.
*/ */
......
...@@ -239,20 +239,6 @@ void UiControllerAndroid::ShowDetails(const DetailsProto& details) { ...@@ -239,20 +239,6 @@ void UiControllerAndroid::ShowDetails(const DetailsProto& details) {
month, day, hour, minute, second); 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 UiControllerAndroid::GetApiKey() {
std::string api_key; std::string api_key;
if (google_apis::IsGoogleChromeAPIKeyUsed()) { if (google_apis::IsGoogleChromeAPIKeyUsed()) {
......
...@@ -42,8 +42,6 @@ class UiControllerAndroid : public UiController, public Client { ...@@ -42,8 +42,6 @@ class UiControllerAndroid : public UiController, public Client {
override; override;
void HideDetails() override; void HideDetails() override;
void ShowDetails(const DetailsProto& details) override; void ShowDetails(const DetailsProto& details) override;
void ShowProgressBar(int progress, const std::string& message) override;
void HideProgressBar() override;
// Overrides Client: // Overrides Client:
std::string GetApiKey() override; std::string GetApiKey() override;
......
...@@ -34,8 +34,6 @@ jumbo_static_library("browser") { ...@@ -34,8 +34,6 @@ jumbo_static_library("browser") {
"actions/select_option_action.h", "actions/select_option_action.h",
"actions/show_details_action.cc", "actions/show_details_action.cc",
"actions/show_details_action.h", "actions/show_details_action.h",
"actions/show_progress_bar_action.cc",
"actions/show_progress_bar_action.h",
"actions/stop_action.cc", "actions/stop_action.cc",
"actions/stop_action.h", "actions/stop_action.h",
"actions/tell_action.cc", "actions/tell_action.cc",
......
...@@ -143,12 +143,6 @@ class ActionDelegate { ...@@ -143,12 +143,6 @@ class ActionDelegate {
// Show contextual information. // Show contextual information.
virtual void ShowDetails(const DetailsProto& details) = 0; 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: protected:
ActionDelegate() = default; ActionDelegate() = default;
}; };
......
...@@ -116,8 +116,6 @@ class MockActionDelegate : public ActionDelegate { ...@@ -116,8 +116,6 @@ class MockActionDelegate : public ActionDelegate {
MOCK_METHOD1(StopCurrentScript, void(const std::string& message)); MOCK_METHOD1(StopCurrentScript, void(const std::string& message));
MOCK_METHOD0(HideDetails, void()); MOCK_METHOD0(HideDetails, void());
MOCK_METHOD1(ShowDetails, void(const DetailsProto& details)); MOCK_METHOD1(ShowDetails, void(const DetailsProto& details));
MOCK_METHOD2(ShowProgressBar, void(int progress, const std::string& message));
MOCK_METHOD0(HideProgressBar, void());
}; };
} // namespace autofill_assistant } // 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 { ...@@ -47,8 +47,6 @@ class MockUiController : public UiController {
callback)); callback));
MOCK_METHOD0(HideDetails, void()); MOCK_METHOD0(HideDetails, void());
MOCK_METHOD1(ShowDetails, void(const DetailsProto& details)); MOCK_METHOD1(ShowDetails, void(const DetailsProto& details));
MOCK_METHOD2(ShowProgressBar, void(int progress, const std::string& message));
MOCK_METHOD0(HideProgressBar, void());
}; };
} // namespace autofill_assistant } // namespace autofill_assistant
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "components/autofill_assistant/browser/actions/reset_action.h" #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/select_option_action.h"
#include "components/autofill_assistant/browser/actions/show_details_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/stop_action.h"
#include "components/autofill_assistant/browser/actions/tell_action.h" #include "components/autofill_assistant/browser/actions/tell_action.h"
#include "components/autofill_assistant/browser/actions/unsupported_action.h" #include "components/autofill_assistant/browser/actions/unsupported_action.h"
...@@ -212,10 +211,6 @@ bool ProtocolUtils::ParseActions( ...@@ -212,10 +211,6 @@ bool ProtocolUtils::ParseActions(
std::make_unique<GetPaymentInformationAction>(action)); std::make_unique<GetPaymentInformationAction>(action));
break; break;
} }
case ActionProto::ActionInfoCase::kShowProgressBar: {
actions->emplace_back(std::make_unique<ShowProgressBarAction>(action));
break;
}
default: default:
case ActionProto::ActionInfoCase::ACTION_INFO_NOT_SET: { case ActionProto::ActionInfoCase::ACTION_INFO_NOT_SET: {
DLOG(ERROR) << "Unknown or unsupported action with action_case=" DLOG(ERROR) << "Unknown or unsupported action with action_case="
......
...@@ -137,14 +137,6 @@ void ScriptExecutor::FocusElement(const std::vector<std::string>& selectors, ...@@ -137,14 +137,6 @@ void ScriptExecutor::FocusElement(const std::vector<std::string>& selectors,
delegate_->GetWebController()->FocusElement(selectors, std::move(callback)); 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, void ScriptExecutor::SetFieldValue(const std::vector<std::string>& selectors,
const std::string& value, const std::string& value,
base::OnceCallback<void(bool)> callback) { base::OnceCallback<void(bool)> callback) {
......
...@@ -97,8 +97,6 @@ class ScriptExecutor : public ActionDelegate { ...@@ -97,8 +97,6 @@ class ScriptExecutor : public ActionDelegate {
void StopCurrentScript(const std::string& message) override; void StopCurrentScript(const std::string& message) override;
void HideDetails() override; void HideDetails() override;
void ShowDetails(const DetailsProto& details) override; void ShowDetails(const DetailsProto& details) override;
void ShowProgressBar(int progress, const std::string& message) override;
void HideProgressBar() override;
private: private:
void OnGetActions(bool result, const std::string& response); void OnGetActions(bool result, const std::string& response);
......
...@@ -199,7 +199,6 @@ message ActionProto { ...@@ -199,7 +199,6 @@ message ActionProto {
UseCreditCardProto use_card = 28; UseCreditCardProto use_card = 28;
UseAddressProto use_address = 29; UseAddressProto use_address = 29;
UploadDomProto upload_dom = 18; UploadDomProto upload_dom = 18;
ShowProgressBarProto show_progress_bar = 24;
HighlightElementProto highlight_element = 31; HighlightElementProto highlight_element = 31;
ShowDetailsProto show_details = 32; ShowDetailsProto show_details = 32;
ResetProto reset = 34; ResetProto reset = 34;
...@@ -348,20 +347,6 @@ message UploadDomProto { ...@@ -348,20 +347,6 @@ message UploadDomProto {
optional ElementReferenceProto tree_root = 1; 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. // Contain all arguments to perform a highlight element action.
message HighlightElementProto { message HighlightElementProto {
// The element to highlight. // The element to highlight.
......
...@@ -72,12 +72,6 @@ class UiController { ...@@ -72,12 +72,6 @@ class UiController {
// Show contextual information. // Show contextual information.
virtual void ShowDetails(const DetailsProto& details) = 0; 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: protected:
UiController() = default; 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