Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2399)

Unified Diff: chrome/browser/ui/views/location_bar/save_credit_card_icon_view.cc

Issue 1396923003: Autofill: Replace "save credit card" infobar with a bubble (Views only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: defined(TOOLKIT_VIEWS) -> defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX). Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/save_credit_card_icon_view.cc
diff --git a/chrome/browser/ui/views/location_bar/save_credit_card_icon_view.cc b/chrome/browser/ui/views/location_bar/save_credit_card_icon_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..06c2dce2c8e6bb4aa5eb77f0c4cbc932b2968324
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/save_credit_card_icon_view.cc
@@ -0,0 +1,53 @@
+// Copyright 2015 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 "chrome/browser/ui/views/location_bar/save_credit_card_icon_view.h"
+
+#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/view_ids.h"
+#include "chrome/browser/ui/views/autofill/save_card_bubble_views.h"
+#include "chrome/grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/vector_icons_public.h"
+
+SaveCreditCardIconView::SaveCreditCardIconView(CommandUpdater* command_updater,
+ Browser* browser)
+ : BubbleIconView(command_updater, IDC_SAVE_CREDIT_CARD_FOR_PAGE),
+ browser_(browser) {
+ set_id(VIEW_ID_SAVE_CREDIT_CARD_BUTTON);
+ SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_SAVE_CREDIT_CARD));
+ SetToggled(false);
+}
+
+SaveCreditCardIconView::~SaveCreditCardIconView() {}
+
+void SaveCreditCardIconView::SetToggled(bool on) {
+ SetActiveInternal(on);
+}
+
+void SaveCreditCardIconView::OnExecuting(
+ BubbleIconView::ExecuteSource execute_source) {}
+
+views::BubbleDelegateView* SaveCreditCardIconView::GetBubble() const {
+ if (!browser_)
+ return nullptr;
+ content::WebContents* web_contents =
+ browser_->tab_strip_model()->GetActiveWebContents();
+ if (!web_contents)
+ return nullptr;
+ autofill::SaveCardBubbleControllerImpl* controller =
+ autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents);
+ if (!controller)
+ return nullptr;
+
+ return static_cast<autofill::SaveCardBubbleViews*>(
+ controller->save_card_bubble_view());
+}
+
+gfx::VectorIconId SaveCreditCardIconView::GetVectorIcon() const {
+ return gfx::VectorIconId::AUTOFILL;
+}
« no previous file with comments | « chrome/browser/ui/views/location_bar/save_credit_card_icon_view.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698