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 "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 const FormData& form_structure, | 34 const FormData& form_structure, |
35 const AutofillMetrics& metric_logger, | 35 const AutofillMetrics& metric_logger, |
36 scoped_refptr<content::MessageLoopRunner> runner) | 36 scoped_refptr<content::MessageLoopRunner> runner) |
37 : AutofillDialogControllerImpl(contents, | 37 : AutofillDialogControllerImpl(contents, |
38 form_structure, | 38 form_structure, |
39 GURL(), | 39 GURL(), |
40 base::Bind(MockCallback)), | 40 base::Bind(MockCallback)), |
41 metric_logger_(metric_logger) , | 41 metric_logger_(metric_logger) , |
42 runner_(runner) {} | 42 runner_(runner) {} |
43 | 43 |
44 virtual ~TestAutofillDialogController() {} | 44 ~TestAutofillDialogController() override {} |
45 | 45 |
46 virtual void ViewClosed() override { | 46 void ViewClosed() override { |
47 DCHECK(runner_.get()); | 47 DCHECK(runner_.get()); |
48 runner_->Quit(); | 48 runner_->Quit(); |
49 AutofillDialogControllerImpl::ViewClosed(); | 49 AutofillDialogControllerImpl::ViewClosed(); |
50 } | 50 } |
51 | 51 |
52 AutofillDialogCocoa* GetView() { | 52 AutofillDialogCocoa* GetView() { |
53 return static_cast<AutofillDialogCocoa*>( | 53 return static_cast<AutofillDialogCocoa*>( |
54 AutofillDialogControllerImpl::view()); | 54 AutofillDialogControllerImpl::view()); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 // To specify our own metric logger. | 58 // To specify our own metric logger. |
59 virtual const AutofillMetrics& GetMetricLogger() const override { | 59 const AutofillMetrics& GetMetricLogger() const override { |
60 return metric_logger_; | 60 return metric_logger_; |
61 } | 61 } |
62 | 62 |
63 const AutofillMetrics& metric_logger_; | 63 const AutofillMetrics& metric_logger_; |
64 scoped_refptr<content::MessageLoopRunner> runner_; | 64 scoped_refptr<content::MessageLoopRunner> runner_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController); | 66 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController); |
67 }; | 67 }; |
68 | 68 |
69 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest { | 69 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest { |
70 public: | 70 public: |
71 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {} | 71 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {} |
72 | 72 |
73 virtual ~AutofillDialogCocoaBrowserTest() {} | 73 virtual ~AutofillDialogCocoaBrowserTest() {} |
74 | 74 |
75 virtual void SetUpOnMainThread() override { | 75 void SetUpOnMainThread() override { |
76 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. | 76 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. |
77 autofill::test::DisableSystemServices(browser()->profile()->GetPrefs()); | 77 autofill::test::DisableSystemServices(browser()->profile()->GetPrefs()); |
78 | 78 |
79 // Stick to local autofill mode. | 79 // Stick to local autofill mode. |
80 browser()->profile()->GetPrefs()->SetBoolean( | 80 browser()->profile()->GetPrefs()->SetBoolean( |
81 ::prefs::kAutofillDialogPayWithoutWallet, true); | 81 ::prefs::kAutofillDialogPayWithoutWallet, true); |
82 | 82 |
83 FormFieldData field; | 83 FormFieldData field; |
84 field.autocomplete_attribute = "cc-number"; | 84 field.autocomplete_attribute = "cc-number"; |
85 FormData form_data; | 85 FormData form_data; |
(...skipping 28 matching lines...) Expand all Loading... |
114 controller()->Show(); | 114 controller()->Show(); |
115 controller()->OnCancel(); | 115 controller()->OnCancel(); |
116 controller()->Hide(); | 116 controller()->Hide(); |
117 | 117 |
118 RunMessageLoop(); | 118 RunMessageLoop(); |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 } // namespace autofill | 123 } // namespace autofill |
OLD | NEW |