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_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_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/autofill/card_unmask_prompt_view.h"
11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
14 class NavigationController
;
17 @
class CardUnmaskPromptViewCocoa
;
21 class CardUnmaskPromptViewBridge
: public CardUnmaskPromptView
,
22 public ConstrainedWindowMacDelegate
{
24 explicit CardUnmaskPromptViewBridge(CardUnmaskPromptController
* controller
);
25 ~CardUnmaskPromptViewBridge() override
;
27 // CardUnmaskPromptView implementation:
28 void ControllerGone() override
;
29 void DisableAndWaitForVerification() override
;
30 void GotVerificationResult(const base::string16
& error_message
,
31 bool allow_retry
) override
;
33 // ConstrainedWindowMacDelegate implementation:
34 void OnConstrainedWindowClosed(ConstrainedWindowMac
* window
) override
;
36 CardUnmaskPromptController
* GetController();
40 scoped_ptr
<ConstrainedWindowMac
> constrained_window_
;
41 base::scoped_nsobject
<CardUnmaskPromptViewCocoa
> view_controller_
;
43 // The controller |this| queries for logic and state.
44 CardUnmaskPromptController
* controller_
;
46 base::WeakPtrFactory
<CardUnmaskPromptViewBridge
> weak_ptr_factory_
;
51 @interface CardUnmaskPromptViewCocoa
52 : NSViewController
<NSWindowDelegate
, NSTextFieldDelegate
>
54 // Designated initializer. |bridge| must not be NULL.
55 - (id
)initWithBridge
:(autofill::CardUnmaskPromptViewBridge
*)bridge
;
57 - (void)setProgressOverlayText
:(const base::string16
&)text
58 showSpinner
:(BOOL
)showSpinner
;
59 - (void)setRetriableErrorMessage
:(const base::string16
&)text
;
60 - (void)setPermanentErrorMessage
:(const base::string16
&)text
;
64 #endif // CHROME_BROWSER_UI_COCOA_CARD_UNMASK_PROMPT_VIEW_BRIDGE_H_