Only show Tooltip on save UI for butter users

Bug: 914438
Change-Id: I8d2bfb4b9cbcafb7a0cc73bcb017c7a19259de4b
Reviewed-on: https://chromium-review.googlesource.com/c/1375457
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Jason Guo <jiahuiguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616518}
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
index 6d4972f..df81b65e 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
@@ -464,6 +464,10 @@
   return current_bubble_type_;
 }
 
+AutofillSyncSigninState SaveCardBubbleControllerImpl::GetSyncState() const {
+  return personal_data_manager_->GetSyncSigninState();
+}
+
 void SaveCardBubbleControllerImpl::DidFinishNavigation(
     content::NavigationHandle* navigation_handle) {
   if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
@@ -643,10 +647,6 @@
   return security_level_;
 }
 
-AutofillSyncSigninState SaveCardBubbleControllerImpl::GetSyncState() const {
-  return personal_data_manager_->GetSyncSigninState();
-}
-
 WEB_CONTENTS_USER_DATA_KEY_IMPL(SaveCardBubbleControllerImpl)
 
 }  // namespace autofill
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
index 1ba178a..2a55e27 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
@@ -118,6 +118,7 @@
   const LegalMessageLines& GetLegalMessageLines() const override;
   bool IsUploadSave() const override;
   BubbleType GetBubbleType() const override;
+  AutofillSyncSigninState GetSyncState() const override;
 
  protected:
   explicit SaveCardBubbleControllerImpl(content::WebContents* web_contents);
@@ -134,9 +135,6 @@
   // Gets the security level of the page.
   virtual security_state::SecurityLevel GetSecurityLevel() const;
 
-  // Gets the current sync state.
-  virtual AutofillSyncSigninState GetSyncState() const;
-
  private:
   friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
   friend class SaveCardBubbleViewsBrowserTestBase;
diff --git a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc
index e303351..3a20e78c 100644
--- a/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc
+++ b/chrome/browser/ui/views/autofill/save_card_offer_bubble_views.cc
@@ -60,8 +60,8 @@
 }
 
 views::View* SaveCardOfferBubbleViews::CreateExtraView() {
-  if (!base::FeatureList::IsEnabled(
-          features::kAutofillSaveCardImprovedUserConsent)) {
+  if (controller()->GetSyncState() !=
+      AutofillSyncSigninState::kSignedInAndWalletSyncTransportEnabled) {
     return nullptr;
   }
 
diff --git a/components/autofill/core/browser/ui/save_card_bubble_controller.h b/components/autofill/core/browser/ui/save_card_bubble_controller.h
index 1ae14e7..d549f55 100644
--- a/components/autofill/core/browser/ui/save_card_bubble_controller.h
+++ b/components/autofill/core/browser/ui/save_card_bubble_controller.h
@@ -12,6 +12,7 @@
 #include "base/strings/string16.h"
 #include "components/autofill/core/browser/autofill_client.h"
 #include "components/autofill/core/browser/legal_message_line.h"
+#include "components/autofill/core/browser/sync_utils.h"
 #include "components/signin/core/browser/account_info.h"
 #include "url/gurl.h"
 
@@ -88,6 +89,8 @@
   virtual bool IsUploadSave() const = 0;
   // Returns the current state of the bubble.
   virtual BubbleType GetBubbleType() const = 0;
+  // Returns the current sync state.
+  virtual AutofillSyncSigninState GetSyncState() const = 0;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController);