| 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 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" | 12 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" |
| 13 #include "chrome/browser/ui/cocoa/base_bubble_controller.h" | 13 #include "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 14 #include "components/autofill/core/browser/credit_card.h" | 14 #include "components/autofill/core/browser/credit_card.h" |
| 15 #include "components/autofill/core/browser/legal_message_line.h" |
| 15 | 16 |
| 16 @class BrowserWindowController; | 17 @class BrowserWindowController; |
| 17 @class SaveCardBubbleViewCocoa; | 18 @class SaveCardBubbleViewCocoa; |
| 18 | 19 |
| 19 namespace autofill { | 20 namespace autofill { |
| 20 | 21 |
| 21 class SaveCardBubbleController; | 22 class SaveCardBubbleController; |
| 22 | 23 |
| 23 class SaveCardBubbleViewBridge : public SaveCardBubbleView { | 24 class SaveCardBubbleViewBridge : public SaveCardBubbleView { |
| 24 public: | 25 public: |
| 25 SaveCardBubbleViewBridge(SaveCardBubbleController* controller, | 26 SaveCardBubbleViewBridge(SaveCardBubbleController* controller, |
| 26 BrowserWindowController* browser_window_controller); | 27 BrowserWindowController* browser_window_controller); |
| 27 | 28 |
| 28 // Returns the title that should be displayed in the bubble. | 29 // Returns the title that should be displayed in the bubble. |
| 29 base::string16 GetWindowTitle() const; | 30 base::string16 GetWindowTitle() const; |
| 30 | 31 |
| 32 // Returns the explanatory text that should be displayed in the bubble. |
| 33 // Returns an empty string if no message should be displayed. |
| 34 base::string16 GetExplanatoryMessage() const; |
| 35 |
| 31 // Returns the card that will be uploaded if the user accepts. | 36 // Returns the card that will be uploaded if the user accepts. |
| 32 CreditCard GetCard() const; | 37 CreditCard GetCard() const; |
| 33 | 38 |
| 39 // Returns the legal messages that should be displayed in the footer. Result |
| 40 // will be empty if no legal message should be shown. |
| 41 const LegalMessageLines GetLegalMessageLines() const; |
| 42 |
| 34 // Interaction. | 43 // Interaction. |
| 35 void OnSaveButton(); | 44 void OnSaveButton(); |
| 36 void OnCancelButton(); | 45 void OnCancelButton(); |
| 37 void OnLearnMoreClicked(); | 46 void OnLearnMoreClicked(); |
| 47 void OnLegalMessageLinkClicked(const GURL& url); |
| 38 void OnBubbleClosed(); | 48 void OnBubbleClosed(); |
| 39 | 49 |
| 40 // SaveCardBubbleView implementation: | 50 // SaveCardBubbleView implementation: |
| 41 void Hide() override; | 51 void Hide() override; |
| 42 | 52 |
| 43 private: | 53 private: |
| 44 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, SaveShouldClose); | 54 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, SaveShouldClose); |
| 45 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, CancelShouldClose); | 55 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, CancelShouldClose); |
| 46 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, LearnMoreShouldNotClose); | 56 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, LearnMoreShouldNotClose); |
| 57 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, LegalMessageShouldNotClose); |
| 47 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, ReturnInvokesDefaultAction); | 58 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, ReturnInvokesDefaultAction); |
| 48 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, EscapeCloses); | 59 FRIEND_TEST_ALL_PREFIXES(SaveCardBubbleViewTest, EscapeCloses); |
| 49 | 60 |
| 50 virtual ~SaveCardBubbleViewBridge(); | 61 virtual ~SaveCardBubbleViewBridge(); |
| 51 | 62 |
| 52 // Weak. | 63 // Weak. |
| 53 SaveCardBubbleViewCocoa* view_controller_; | 64 SaveCardBubbleViewCocoa* view_controller_; |
| 54 | 65 |
| 55 // Weak. Queried for state and notified of user input. | 66 // Weak. Queried for state and notified of user input. |
| 56 SaveCardBubbleController* controller_; | 67 SaveCardBubbleController* controller_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 (BrowserWindowController*)browserWindowController | 78 (BrowserWindowController*)browserWindowController |
| 68 bridge: | 79 bridge: |
| 69 (autofill::SaveCardBubbleViewBridge*)bridge; | 80 (autofill::SaveCardBubbleViewBridge*)bridge; |
| 70 | 81 |
| 71 - (void)onSaveButton:(id)sender; | 82 - (void)onSaveButton:(id)sender; |
| 72 - (void)onCancelButton:(id)sender; | 83 - (void)onCancelButton:(id)sender; |
| 73 | 84 |
| 74 @end | 85 @end |
| 75 | 86 |
| 76 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ | 87 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_SAVE_CARD_BUBBLE_VIEW_BRIDGE_H_ |
| OLD | NEW |