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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_
8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.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"
17 @
class CardUnmaskPromptViewCocoa
;
21 class CardUnmaskPromptViewBridge
: public CardUnmaskPromptView
,
22 public ConstrainedWindowMacDelegate
{
24 explicit CardUnmaskPromptViewBridge(CardUnmaskPromptController
* controller
,
25 content::WebContents
* web_contents
);
26 ~CardUnmaskPromptViewBridge() override
;
28 // CardUnmaskPromptView implementation:
30 void ControllerGone() override
;
31 void DisableAndWaitForVerification() override
;
32 void GotVerificationResult(const base::string16
& error_message
,
33 bool allow_retry
) override
;
35 // ConstrainedWindowMacDelegate implementation:
36 void OnConstrainedWindowClosed(ConstrainedWindowMac
* window
) override
;
38 CardUnmaskPromptController
* GetController();
39 content::WebContents
* GetWebContents();
44 scoped_ptr
<ConstrainedWindowMac
> constrained_window_
;
45 base::scoped_nsobject
<CardUnmaskPromptViewCocoa
> view_controller_
;
47 // The controller |this| queries for logic and state.
48 CardUnmaskPromptController
* controller_
;
50 content::WebContents
* web_contents_
;
51 base::WeakPtrFactory
<CardUnmaskPromptViewBridge
> weak_ptr_factory_
;
54 } // namespace autofill
56 @interface CardUnmaskPromptViewCocoa
57 : NSViewController
<NSWindowDelegate
, NSTextFieldDelegate
>
59 // Designated initializer. |bridge| must not be NULL.
60 - (id
)initWithBridge
:(autofill::CardUnmaskPromptViewBridge
*)bridge
;
62 - (void)setProgressOverlayText
:(const base::string16
&)text
63 showSpinner
:(BOOL
)showSpinner
;
64 - (void)setRetriableErrorMessage
:(const base::string16
&)text
;
65 - (void)setPermanentErrorMessage
:(const base::string16
&)text
;
69 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_