| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" | 5 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/app/vector_icons/vector_icons.h" |
| 8 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
| 12 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" | 13 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/gfx/vector_icons_public.h" | 16 #include "ui/gfx/vector_icons_public.h" |
| 16 | 17 |
| 17 namespace autofill { | 18 namespace autofill { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 views::BubbleDialogDelegateView* SaveCardIconView::GetBubble() const { | 35 views::BubbleDialogDelegateView* SaveCardIconView::GetBubble() const { |
| 35 SaveCardBubbleControllerImpl* controller = GetController(); | 36 SaveCardBubbleControllerImpl* controller = GetController(); |
| 36 if (!controller) | 37 if (!controller) |
| 37 return nullptr; | 38 return nullptr; |
| 38 | 39 |
| 39 return static_cast<autofill::SaveCardBubbleViews*>( | 40 return static_cast<autofill::SaveCardBubbleViews*>( |
| 40 controller->save_card_bubble_view()); | 41 controller->save_card_bubble_view()); |
| 41 } | 42 } |
| 42 | 43 |
| 43 gfx::VectorIconId SaveCardIconView::GetVectorIcon() const { | 44 const gfx::VectorIcon& SaveCardIconView::GetVectorIcon() const { |
| 44 return gfx::VectorIconId::CREDIT_CARD; | 45 return kCreditCardIcon; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void SaveCardIconView::TabDeactivated(content::WebContents* contents) { | 48 void SaveCardIconView::TabDeactivated(content::WebContents* contents) { |
| 48 SaveCardBubbleControllerImpl* controller = GetController(); | 49 SaveCardBubbleControllerImpl* controller = GetController(); |
| 49 if (controller) | 50 if (controller) |
| 50 controller->HideBubble(); | 51 controller->HideBubble(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 SaveCardBubbleControllerImpl* SaveCardIconView::GetController() const { | 54 SaveCardBubbleControllerImpl* SaveCardIconView::GetController() const { |
| 54 if (!browser_) | 55 if (!browser_) |
| 55 return nullptr; | 56 return nullptr; |
| 56 content::WebContents* web_contents = | 57 content::WebContents* web_contents = |
| 57 browser_->tab_strip_model()->GetActiveWebContents(); | 58 browser_->tab_strip_model()->GetActiveWebContents(); |
| 58 if (!web_contents) | 59 if (!web_contents) |
| 59 return nullptr; | 60 return nullptr; |
| 60 return autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents); | 61 return autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents); |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace autofill | 64 } // namespace autofill |
| OLD | NEW |