OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 4 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace { | 22 namespace { |
23 | 23 |
24 void MockCallback(const FormStructure*, const std::string&) {} | 24 void MockCallback(const FormStructure*, const std::string&) {} |
25 | 25 |
26 class TestAutofillDialogController : public AutofillDialogControllerImpl { | 26 class TestAutofillDialogController : public AutofillDialogControllerImpl { |
27 public: | 27 public: |
28 TestAutofillDialogController( | 28 TestAutofillDialogController( |
29 content::WebContents* contents, | 29 content::WebContents* contents, |
30 const FormData& form_structure, | 30 const FormData& form_structure, |
31 const AutofillMetrics& metric_logger, | 31 const AutofillMetrics& metric_logger, |
32 scoped_refptr<content::MessageLoopRunner> runner, | 32 scoped_refptr<content::MessageLoopRunner> runner) |
33 const DialogType dialog_type) | |
34 : AutofillDialogControllerImpl(contents, | 33 : AutofillDialogControllerImpl(contents, |
35 form_structure, | 34 form_structure, |
36 GURL(), | 35 GURL(), |
37 dialog_type, | |
38 base::Bind(MockCallback)), | 36 base::Bind(MockCallback)), |
39 metric_logger_(metric_logger) , | 37 metric_logger_(metric_logger) , |
40 runner_(runner) { | 38 runner_(runner) { |
41 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); | 39 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); |
42 } | 40 } |
43 | 41 |
44 virtual ~TestAutofillDialogController() {} | 42 virtual ~TestAutofillDialogController() {} |
45 | 43 |
46 virtual void ViewClosed() OVERRIDE { | 44 virtual void ViewClosed() OVERRIDE { |
47 DCHECK(runner_.get()); | 45 DCHECK(runner_.get()); |
(...skipping 30 matching lines...) Expand all Loading... |
78 | 76 |
79 FormFieldData field; | 77 FormFieldData field; |
80 field.autocomplete_attribute = "cc-number"; | 78 field.autocomplete_attribute = "cc-number"; |
81 FormData form_data; | 79 FormData form_data; |
82 form_data.fields.push_back(field); | 80 form_data.fields.push_back(field); |
83 runner_ = new content::MessageLoopRunner; | 81 runner_ = new content::MessageLoopRunner; |
84 controller_ = new TestAutofillDialogController( | 82 controller_ = new TestAutofillDialogController( |
85 browser()->tab_strip_model()->GetActiveWebContents(), | 83 browser()->tab_strip_model()->GetActiveWebContents(), |
86 form_data, | 84 form_data, |
87 metric_logger_, | 85 metric_logger_, |
88 runner_, | 86 runner_); |
89 DIALOG_TYPE_REQUEST_AUTOCOMPLETE); | |
90 } | 87 } |
91 | 88 |
92 TestAutofillDialogController* controller() { return controller_; } | 89 TestAutofillDialogController* controller() { return controller_; } |
93 | 90 |
94 void RunMessageLoop() { | 91 void RunMessageLoop() { |
95 DCHECK(runner_.get()); | 92 DCHECK(runner_.get()); |
96 runner_->Run(); | 93 runner_->Run(); |
97 } | 94 } |
98 | 95 |
99 private: | 96 private: |
(...skipping 11 matching lines...) Expand all Loading... |
111 controller()->Show(); | 108 controller()->Show(); |
112 controller()->OnCancel(); | 109 controller()->OnCancel(); |
113 controller()->Hide(); | 110 controller()->Hide(); |
114 | 111 |
115 RunMessageLoop(); | 112 RunMessageLoop(); |
116 } | 113 } |
117 | 114 |
118 } // namespace | 115 } // namespace |
119 | 116 |
120 } // namespace autofill | 117 } // namespace autofill |
OLD | NEW |