| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" | |
| 11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 11 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class NavigationController; | 14 class WebContents; |
| 15 } | 15 } |
| 16 | 16 |
| 17 @class CardUnmaskPromptViewCocoa; | 17 @class CardUnmaskPromptViewCocoa; |
| 18 | 18 |
| 19 namespace autofill { | 19 namespace autofill { |
| 20 | 20 |
| 21 class CardUnmaskPromptViewBridge : public CardUnmaskPromptView, | 21 class CardUnmaskPromptViewBridge : public CardUnmaskPromptView, |
| 22 public ConstrainedWindowMacDelegate { | 22 public ConstrainedWindowMacDelegate { |
| 23 public: | 23 public: |
| 24 explicit CardUnmaskPromptViewBridge(CardUnmaskPromptController* controller); | 24 explicit CardUnmaskPromptViewBridge(CardUnmaskPromptController* controller, |
| 25 content::WebContents* web_contents); |
| 25 ~CardUnmaskPromptViewBridge() override; | 26 ~CardUnmaskPromptViewBridge() override; |
| 26 | 27 |
| 27 // CardUnmaskPromptView implementation: | 28 // CardUnmaskPromptView implementation: |
| 29 void Show() override; |
| 28 void ControllerGone() override; | 30 void ControllerGone() override; |
| 29 void DisableAndWaitForVerification() override; | 31 void DisableAndWaitForVerification() override; |
| 30 void GotVerificationResult(const base::string16& error_message, | 32 void GotVerificationResult(const base::string16& error_message, |
| 31 bool allow_retry) override; | 33 bool allow_retry) override; |
| 32 | 34 |
| 33 // ConstrainedWindowMacDelegate implementation: | 35 // ConstrainedWindowMacDelegate implementation: |
| 34 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | 36 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
| 35 | 37 |
| 36 CardUnmaskPromptController* GetController(); | 38 CardUnmaskPromptController* GetController(); |
| 37 void PerformClose(); | 39 void PerformClose(); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 42 scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| 41 base::scoped_nsobject<CardUnmaskPromptViewCocoa> view_controller_; | 43 base::scoped_nsobject<CardUnmaskPromptViewCocoa> view_controller_; |
| 42 | 44 |
| 43 // The controller |this| queries for logic and state. | 45 // The controller |this| queries for logic and state. |
| 44 CardUnmaskPromptController* controller_; | 46 CardUnmaskPromptController* controller_; |
| 45 | 47 |
| 48 content::WebContents* web_contents_; |
| 46 base::WeakPtrFactory<CardUnmaskPromptViewBridge> weak_ptr_factory_; | 49 base::WeakPtrFactory<CardUnmaskPromptViewBridge> weak_ptr_factory_; |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 } // autofill | 52 } // namespace autofill |
| 50 | 53 |
| 51 @interface CardUnmaskPromptViewCocoa | 54 @interface CardUnmaskPromptViewCocoa |
| 52 : NSViewController<NSWindowDelegate, NSTextFieldDelegate> | 55 : NSViewController<NSWindowDelegate, NSTextFieldDelegate> |
| 53 | 56 |
| 54 // Designated initializer. |bridge| must not be NULL. | 57 // Designated initializer. |bridge| must not be NULL. |
| 55 - (id)initWithBridge:(autofill::CardUnmaskPromptViewBridge*)bridge; | 58 - (id)initWithBridge:(autofill::CardUnmaskPromptViewBridge*)bridge; |
| 56 | 59 |
| 57 - (void)setProgressOverlayText:(const base::string16&)text | 60 - (void)setProgressOverlayText:(const base::string16&)text |
| 58 showSpinner:(BOOL)showSpinner; | 61 showSpinner:(BOOL)showSpinner; |
| 59 - (void)setRetriableErrorMessage:(const base::string16&)text; | 62 - (void)setRetriableErrorMessage:(const base::string16&)text; |
| 60 - (void)setPermanentErrorMessage:(const base::string16&)text; | 63 - (void)setPermanentErrorMessage:(const base::string16&)text; |
| 61 | 64 |
| 62 @end | 65 @end |
| 63 | 66 |
| 64 #endif // CHROME_BROWSER_UI_COCOA_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ | 67 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_ |
| OLD | NEW |