| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_view_tester_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_view_tester_cocoa.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 8 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
| 9 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" | 10 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
| 11 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" | 11 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| 12 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" |
| 13 | 13 |
| 14 | 14 |
| 15 // Mirrors the AutofillDialogViewTester API on the C++ side. | 15 // Mirrors the AutofillDialogViewTester API on the C++ side. |
| 16 @interface AutofillDialogWindowController (AutofillDialogViewTesterCocoa) | 16 @interface AutofillDialogWindowController (AutofillDialogViewTesterCocoa) |
| 17 | 17 |
| 18 - (void)setTextContents:(NSString*)text | 18 - (void)setTextContents:(NSString*)text |
| 19 forType:(autofill::ServerFieldType)type; | 19 forType:(autofill::ServerFieldType)type; |
| 20 - (void)setTextContents:(NSString*)text | 20 - (void)setTextContents:(NSString*)text |
| 21 ofSuggestionForSection:(autofill::DialogSection)section; | 21 ofSuggestionForSection:(autofill::DialogSection)section; |
| 22 - (void)activateFieldForType:(autofill::ServerFieldType)type; | 22 - (void)activateFieldForType:(autofill::ServerFieldType)type; |
| 23 - (content::WebContents*)getSignInWebContents; | 23 - (content::WebContents*)getSignInWebContents; |
| 24 - (BOOL)isShowingOverlay; | 24 - (BOOL)isShowingOverlay; |
| 25 - (BOOL)isShowingSection:(autofill::DialogSection)section; |
| 25 | 26 |
| 26 @end | 27 @end |
| 27 | 28 |
| 28 | 29 |
| 29 @implementation AutofillDialogWindowController (AutofillDialogViewTesterCocoa) | 30 @implementation AutofillDialogWindowController (AutofillDialogViewTesterCocoa) |
| 30 | 31 |
| 31 - (void)setTextContents:(NSString*)text | 32 - (void)setTextContents:(NSString*)text |
| 32 forType:(autofill::ServerFieldType)type { | 33 forType:(autofill::ServerFieldType)type { |
| 33 for (size_t i = autofill::SECTION_MIN; i <= autofill::SECTION_MAX; ++i) { | 34 for (size_t i = autofill::SECTION_MIN; i <= autofill::SECTION_MAX; ++i) { |
| 34 autofill::DialogSection section = static_cast<autofill::DialogSection>(i); | 35 autofill::DialogSection section = static_cast<autofill::DialogSection>(i); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 - (content::WebContents*)getSignInWebContents { | 57 - (content::WebContents*)getSignInWebContents { |
| 57 return [signInContainer_ webContents]; | 58 return [signInContainer_ webContents]; |
| 58 } | 59 } |
| 59 | 60 |
| 60 - (BOOL)isShowingOverlay { | 61 - (BOOL)isShowingOverlay { |
| 61 return ![[overlayController_ view] isHidden]; | 62 return ![[overlayController_ view] isHidden]; |
| 62 } | 63 } |
| 63 | 64 |
| 65 - (BOOL)isShowingSection:(autofill::DialogSection)section { |
| 66 return ![[[mainContainer_ sectionForId:section] view] isHidden]; |
| 67 } |
| 68 |
| 64 @end | 69 @end |
| 65 | 70 |
| 66 namespace autofill { | 71 namespace autofill { |
| 67 | 72 |
| 68 scoped_ptr<AutofillDialogViewTester> AutofillDialogViewTester::For( | 73 scoped_ptr<AutofillDialogViewTester> AutofillDialogViewTester::For( |
| 69 AutofillDialogView* dialog) { | 74 AutofillDialogView* dialog) { |
| 70 return scoped_ptr<AutofillDialogViewTester>( | 75 return scoped_ptr<AutofillDialogViewTester>( |
| 71 new AutofillDialogViewTesterCocoa( | 76 new AutofillDialogViewTesterCocoa( |
| 72 static_cast<AutofillDialogCocoa*>(dialog))); | 77 static_cast<AutofillDialogCocoa*>(dialog))); |
| 73 } | 78 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 131 } |
| 127 | 132 |
| 128 content::WebContents* AutofillDialogViewTesterCocoa::GetSignInWebContents() { | 133 content::WebContents* AutofillDialogViewTesterCocoa::GetSignInWebContents() { |
| 129 return [controller() getSignInWebContents]; | 134 return [controller() getSignInWebContents]; |
| 130 } | 135 } |
| 131 | 136 |
| 132 bool AutofillDialogViewTesterCocoa::IsShowingOverlay() const { | 137 bool AutofillDialogViewTesterCocoa::IsShowingOverlay() const { |
| 133 return [controller() isShowingOverlay]; | 138 return [controller() isShowingOverlay]; |
| 134 } | 139 } |
| 135 | 140 |
| 141 bool AutofillDialogViewTesterCocoa::IsShowingSection( |
| 142 autofill::DialogSection section) const { |
| 143 return [controller() isShowingSection:section]; |
| 144 } |
| 145 |
| 136 AutofillDialogWindowController* | 146 AutofillDialogWindowController* |
| 137 AutofillDialogViewTesterCocoa::controller() const { | 147 AutofillDialogViewTesterCocoa::controller() const { |
| 138 return dialog_->sheet_delegate_; | 148 return dialog_->sheet_delegate_; |
| 139 } | 149 } |
| 140 | 150 |
| 141 } // namespace autofill | 151 } // namespace autofill |
| OLD | NEW |