Commit 050d6f67 authored by aruslan@chromium.org's avatar aruslan@chromium.org

Rename AutofillDialogController to AutofillDialogViewDelegate.

BUG=259089

Review URL: https://chromiumcodereview.appspot.com/21692002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215951 0039d316-1c4b-4281-b951-d872f2087c98
parent c07fa8f0
......@@ -301,7 +301,7 @@ bool IsInstrumentAllowed(
// Signals that the user has opted in to geolocation services. Factored out
// into a separate method because all interaction with the geolocation provider
// needs to happen on the IO thread, which is not the thread
// AutofillDialogController lives on.
// AutofillDialogViewDelegate lives on.
void UserDidOptIntoLocationServices() {
content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
}
......@@ -448,7 +448,7 @@ gfx::Image GetGeneratedCardImage(const string16& card_number) {
} // namespace
AutofillDialogController::~AutofillDialogController() {}
AutofillDialogViewDelegate::~AutofillDialogViewDelegate() {}
AutofillDialogControllerImpl::~AutofillDialogControllerImpl() {
if (popup_controller_)
......@@ -719,7 +719,7 @@ std::vector<DialogAutocheckoutStep>
}
////////////////////////////////////////////////////////////////////////////////
// AutofillDialogController implementation.
// AutofillDialogViewDelegate implementation.
string16 AutofillDialogControllerImpl::DialogTitle() const {
return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_TITLE);
......
......@@ -14,9 +14,9 @@
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "chrome/browser/ui/autofill/account_chooser_model.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
#include "chrome/browser/ui/autofill/country_combobox_model.h"
#include "components/autofill/content/browser/autocheckout_steps.h"
......@@ -66,7 +66,7 @@ class WalletSigninHelper;
// This class drives the dialog that appears when a site uses the imperative
// autocomplete API to fill out a form.
class AutofillDialogControllerImpl : public AutofillDialogController,
class AutofillDialogControllerImpl : public AutofillDialogViewDelegate,
public AutofillPopupDelegate,
public content::NotificationObserver,
public SuggestionsMenuModelDelegate,
......@@ -111,7 +111,7 @@ class AutofillDialogControllerImpl : public AutofillDialogController,
// actually implements |AutofillDialogView::GetTestableView()|).
TestableAutofillDialogView* GetTestableView();
// AutofillDialogController implementation.
// AutofillDialogViewDelegate implementation.
virtual string16 DialogTitle() const OVERRIDE;
virtual string16 AccountChooserText() const OVERRIDE;
virtual string16 SignInLinkText() const OVERRIDE;
......
......@@ -15,7 +15,7 @@ AutofillDialogView::~AutofillDialogView() {}
#if defined(TOOLKIT_GTK) || defined(OS_ANDROID)
// TODO(estade): implement the dialog on GTK. See http://crbug.com/157275.
AutofillDialogView* AutofillDialogView::Create(
AutofillDialogController* controller) {
AutofillDialogViewDelegate* delegate) {
return NULL;
}
#endif
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
namespace content {
class NavigationController;
......@@ -17,7 +17,7 @@ class Size;
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
class TestableAutofillDialogView;
// An interface for the dialog that appears when a site initiates an Autofill
......@@ -96,7 +96,7 @@ class AutofillDialogView {
// Factory function to create the dialog (implemented once per view
// implementation). |controller| will own the created dialog.
static AutofillDialogView* Create(AutofillDialogController* controller);
static AutofillDialogView* Create(AutofillDialogViewDelegate* delegate);
};
} // namespace autofill
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
#include <vector>
......@@ -35,7 +35,7 @@ class MenuModel;
namespace autofill {
// This class defines the interface to the controller that the dialog view sees.
class AutofillDialogController {
class AutofillDialogViewDelegate {
public:
// Strings -------------------------------------------------------------------
......@@ -208,9 +208,9 @@ class AutofillDialogController {
virtual content::WebContents* web_contents() = 0;
protected:
virtual ~AutofillDialogController();
virtual ~AutofillDialogViewDelegate();
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_
#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#include "content/public/browser/native_web_keyboard_event.h" // For gmock.
#include "grit/generated_resources.h"
#include "ui/gfx/rect.h" // Only needed because gmock needs complete types.
namespace autofill {
MockAutofillDialogController::MockAutofillDialogController() {
MockAutofillDialogViewDelegate::MockAutofillDialogViewDelegate() {
using testing::DefaultValue;
using testing::_;
using testing::Return;
......@@ -49,7 +49,7 @@ MockAutofillDialogController::MockAutofillDialogController() {
.WillByDefault(Return(false));
}
MockAutofillDialogController::~MockAutofillDialogController() {
MockAutofillDialogViewDelegate::~MockAutofillDialogViewDelegate() {
using testing::DefaultValue;
DefaultValue<SuggestionState>::Clear();
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_CONTROLLER_H_
#define CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_CONTROLLER_H_
#ifndef CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
#define CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace autofill {
class MockAutofillDialogController : public AutofillDialogController {
class MockAutofillDialogViewDelegate : public AutofillDialogViewDelegate {
public:
MockAutofillDialogController();
virtual ~MockAutofillDialogController();
MockAutofillDialogViewDelegate();
virtual ~MockAutofillDialogViewDelegate();
MOCK_CONST_METHOD0(DialogTitle, string16());
MOCK_CONST_METHOD0(AccountChooserText, string16());
......@@ -83,4 +83,4 @@ class MockAutofillDialogController : public AutofillDialogController {
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_CONTROLLER_H_
#endif // CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
......@@ -10,7 +10,7 @@
#include "base/mac/scoped_nsobject.h"
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
@class MenuButton;
......@@ -20,11 +20,11 @@ namespace autofill {
base::scoped_nsobject<NSButton> link_;
base::scoped_nsobject<MenuButton> popup_;
base::scoped_nsobject<NSImageView> icon_;
autofill::AutofillDialogController* controller_; // weak.
autofill::AutofillDialogViewDelegate* delegate_; // weak.
}
- (id)initWithFrame:(NSRect)frame
controller:(autofill::AutofillDialogController*)controller;
delegate:(autofill::AutofillDialogViewDelegate*)delegate;
- (void)update;
@end
......
......@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/chrome_style.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
#import "chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.h"
......@@ -47,15 +47,15 @@ void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title,
@implementation AutofillAccountChooser
- (id)initWithFrame:(NSRect)frame
controller:(autofill::AutofillDialogController*)controller {
delegate:(autofill::AutofillDialogViewDelegate*)delegate {
if ((self = [super initWithFrame:frame])) {
controller_ = controller;
delegate_ = delegate;
icon_.reset([[NSImageView alloc] initWithFrame:NSZeroRect]);
[icon_ setImageFrameStyle:NSImageFrameNone];
link_.reset([[HyperlinkButtonCell buttonWithString:
base::SysUTF16ToNSString(controller_->SignInLinkText())] retain]);
base::SysUTF16ToNSString(delegate_->SignInLinkText())] retain]);
[link_ setAction:@selector(linkClicked:)];
[link_ setTarget:self];
[[link_ cell] setUnderlineOnHover:YES];
......@@ -86,26 +86,26 @@ void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title,
}
- (void)optionsMenuChanged:(id)sender {
ui::MenuModel* menuModel = controller_->MenuModelForAccountChooser();
ui::MenuModel* menuModel = delegate_->MenuModelForAccountChooser();
DCHECK(menuModel);
menuModel->ActivatedAt([sender tag]);
}
- (void)linkClicked:(id)sender {
controller_->SignInLinkClicked();
delegate_->SignInLinkClicked();
}
- (void)update {
NSImage* iconImage = controller_->AccountChooserImage().AsNSImage();
NSImage* iconImage = delegate_->AccountChooserImage().AsNSImage();
[icon_ setImage:iconImage];
// Set title.
NSString* popupTitle =
base::SysUTF16ToNSString(controller_->AccountChooserText());
base::SysUTF16ToNSString(delegate_->AccountChooserText());
[popup_ setTitle:popupTitle];
NSString* linkTitle =
base::SysUTF16ToNSString(controller_->SignInLinkText());
base::SysUTF16ToNSString(delegate_->SignInLinkText());
[link_ setTitle:linkTitle];
// populate menu
......@@ -113,7 +113,7 @@ void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title,
[accountMenu removeAllItems];
// See menu_button.h for documentation on why this is needed.
[accountMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
ui::MenuModel* model = controller_->MenuModelForAccountChooser();
ui::MenuModel* model = delegate_->MenuModelForAccountChooser();
if (model) {
for (int i = 0; i < model->GetItemCount(); ++i) {
AddMenuItem(accountMenu,
......
......@@ -7,7 +7,7 @@
#import <Cocoa/Cocoa.h>
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/menu_button.h"
#include "testing/gtest_mac.h"
#include "testing/platform_test.h"
......@@ -22,13 +22,13 @@ class AutofillAccountChooserTest : public ui::CocoaTest {
AutofillAccountChooserTest() {
NSRect frame = NSMakeRect(0, 0, 500, 200);
view_.reset([[AutofillAccountChooser alloc] initWithFrame:frame
controller:&controller_]);
delegate:&delegate_]);
[[test_window() contentView] addSubview:view_];
}
protected:
base::scoped_nsobject<AutofillAccountChooser> view_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
private:
DISALLOW_COPY_AND_ASSIGN(AutofillAccountChooserTest);
......@@ -85,7 +85,7 @@ TEST_F(AutofillAccountChooserTest, PopulatesMenu) {
model.AddItem(1, ASCIIToUTF16("one"));
model.AddItem(2, ASCIIToUTF16("two"));
EXPECT_CALL(controller_, MenuModelForAccountChooser())
EXPECT_CALL(delegate_, MenuModelForAccountChooser())
.WillOnce(Return(&model));
[view_ update];
......
......@@ -14,7 +14,7 @@
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
@class InfoBubbleView;
......@@ -33,16 +33,16 @@ class AutofillDialogController;
// An info bubble to display validation errors.
base::scoped_nsobject<InfoBubbleView> infoBubble_;
autofill::AutofillDialogController* controller_; // Not owned.
autofill::AutofillDialogViewDelegate* delegate_; // Not owned.
}
// Designated initializer.
- (id)initWithController:(autofill::AutofillDialogController*)controller;
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
// Retrieve the container for the specified |section|.
- (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
// Called when the controller-maintained suggestions model has changed.
// Called when the delegate-maintained suggestions model has changed.
- (void)modelChanged;
// Validate every visible details section.
......
......@@ -7,7 +7,7 @@
#include <algorithm>
#include "base/mac/foundation_util.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#include "skia/ext/skia_utils_mac.h"
......@@ -26,16 +26,16 @@ SkColor const kWarningColor = 0xffde4932; // SkColorSetRGB(0xde, 0x49, 0x32);
@implementation AutofillDetailsContainer
- (id)initWithController:(autofill::AutofillDialogController*)controller {
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
if (self = [super init]) {
controller_ = controller;
delegate_ = delegate;
}
return self;
}
- (void)addSection:(autofill::DialogSection)section {
base::scoped_nsobject<AutofillSectionContainer> sectionContainer(
[[AutofillSectionContainer alloc] initWithController:controller_
[[AutofillSectionContainer alloc] initWithDelegate:delegate_
forSection:section]);
[sectionContainer setValidationDelegate:self];
[details_ addObject:sectionContainer];
......
......@@ -7,7 +7,7 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/utf_string_conversions.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#import "ui/base/test/ui_cocoa_test_helper.h"
......@@ -17,14 +17,14 @@ namespace {
class AutofillDetailsContainerTest : public ui::CocoaTest {
public:
AutofillDetailsContainerTest() {
container_.reset([[AutofillDetailsContainer alloc] initWithController:
&controller_]);
container_.reset([[AutofillDetailsContainer alloc] initWithDelegate:
&delegate_]);
[[test_window() contentView] addSubview:[container_ view]];
}
protected:
base::scoped_nsobject<AutofillDetailsContainer> container_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
};
} // namespace
......@@ -47,7 +47,7 @@ TEST_F(AutofillDetailsContainerTest, ValidateAllSections) {
DetailOutputMap output;
ValidityData validity;
EXPECT_CALL(controller_, InputsAreValid(_, _, VALIDATE_FINAL))
EXPECT_CALL(delegate_, InputsAreValid(_, _, VALIDATE_FINAL))
.Times(4)
.WillOnce(Return(validity))
.WillOnce(Return(validity))
......@@ -59,7 +59,7 @@ TEST_F(AutofillDetailsContainerTest, ValidateAllSections) {
ValidityData invalid;
invalid[ADDRESS_HOME_ZIP] = ASCIIToUTF16("Some error message");
EXPECT_CALL(controller_, InputsAreValid(_, _, VALIDATE_FINAL))
EXPECT_CALL(delegate_, InputsAreValid(_, _, VALIDATE_FINAL))
.Times(4)
.WillOnce(Return(validity))
.WillOnce(Return(validity))
......
......@@ -20,7 +20,7 @@ namespace content {
}
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
@class AutofillAccountChooser;
......@@ -34,7 +34,7 @@ class AutofillDialogCocoa : public AutofillDialogView,
public TestableAutofillDialogView,
public ConstrainedWindowMacDelegate {
public:
explicit AutofillDialogCocoa(AutofillDialogController* controller);
explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate);
virtual ~AutofillDialogCocoa();
// AutofillDialogView implementation:
......@@ -78,7 +78,7 @@ class AutofillDialogCocoa : public AutofillDialogView,
virtual void OnConstrainedWindowClosed(
ConstrainedWindowMac* window) OVERRIDE;
AutofillDialogController* controller() { return controller_; }
AutofillDialogViewDelegate* delegate() { return delegate_; }
// Posts a close request on the current message loop.
void PerformClose();
......@@ -88,13 +88,13 @@ class AutofillDialogCocoa : public AutofillDialogView,
void CloseNow();
scoped_ptr<ConstrainedWindowMac> constrained_window_;
base::scoped_nsobject<AutofillDialogWindowController> sheet_controller_;
base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_;
// WeakPtrFactory for deferred close.
base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_;
// The controller |this| queries for logic and state.
AutofillDialogController* controller_;
// The delegate |this| queries for logic and state.
AutofillDialogViewDelegate* delegate_;
};
} // autofill
......@@ -117,7 +117,7 @@ class AutofillDialogCocoa : public AutofillDialogView,
// A child view request re-layouting.
- (void)requestRelayout;
// Validate data. If it is valid, notify the controller that the user would
// Validate data. If it is valid, notify the delegate that the user would
// like to use the data.
- (IBAction)accept:(id)sender;
......
......@@ -9,7 +9,7 @@
#include "base/mac/scoped_nsobject.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/chrome_style.h"
#include "chrome/browser/ui/chrome_style.h"
#include "chrome/browser/ui/chrome_style.h"
......@@ -38,13 +38,13 @@ namespace autofill {
// static
AutofillDialogView* AutofillDialogView::Create(
AutofillDialogController* controller) {
return new AutofillDialogCocoa(controller);
AutofillDialogViewDelegate* delegate) {
return new AutofillDialogCocoa(delegate);
}
AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogController* controller)
AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate)
: close_weak_ptr_factory_(this),
controller_(controller) {
delegate_(delegate) {
}
AutofillDialogCocoa::~AutofillDialogCocoa() {
......@@ -52,19 +52,19 @@ AutofillDialogCocoa::~AutofillDialogCocoa() {
void AutofillDialogCocoa::Show() {
// This should only be called once.
DCHECK(!sheet_controller_.get());
sheet_controller_.reset([[AutofillDialogWindowController alloc]
initWithWebContents:controller_->web_contents()
DCHECK(!sheet_delegate_.get());
sheet_delegate_.reset([[AutofillDialogWindowController alloc]
initWithWebContents:delegate_->web_contents()
autofillDialog:this]);
base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
[[CustomConstrainedWindowSheet alloc]
initWithCustomWindow:[sheet_controller_ window]]);
initWithCustomWindow:[sheet_delegate_ window]]);
constrained_window_.reset(
new ConstrainedWindowMac(this, controller_->web_contents(), sheet));
new ConstrainedWindowMac(this, delegate_->web_contents(), sheet));
}
void AutofillDialogCocoa::Hide() {
[sheet_controller_ hide];
[sheet_delegate_ hide];
}
void AutofillDialogCocoa::PerformClose() {
......@@ -81,7 +81,7 @@ void AutofillDialogCocoa::CloseNow() {
}
void AutofillDialogCocoa::UpdateAccountChooser() {
[sheet_controller_ updateAccountChooser];
[sheet_delegate_ updateAccountChooser];
}
void AutofillDialogCocoa::UpdateButtonStrip() {
......@@ -94,24 +94,24 @@ void AutofillDialogCocoa::UpdateForErrors() {
}
void AutofillDialogCocoa::UpdateNotificationArea() {
[sheet_controller_ updateNotificationArea];
[sheet_delegate_ updateNotificationArea];
}
void AutofillDialogCocoa::UpdateAutocheckoutStepsArea() {
}
void AutofillDialogCocoa::UpdateSection(DialogSection section) {
[sheet_controller_ updateSection:section];
[sheet_delegate_ updateSection:section];
}
void AutofillDialogCocoa::FillSection(DialogSection section,
const DetailInput& originating_input) {
[sheet_controller_ fillSection:section forInput:originating_input];
[sheet_delegate_ fillSection:section forInput:originating_input];
}
void AutofillDialogCocoa::GetUserInput(DialogSection section,
DetailOutputMap* output) {
[sheet_controller_ getInputs:output forSection:section];
[sheet_delegate_ getInputs:output forSection:section];
}
string16 AutofillDialogCocoa::GetCvc() {
......@@ -119,21 +119,21 @@ string16 AutofillDialogCocoa::GetCvc() {
}
bool AutofillDialogCocoa::SaveDetailsLocally() {
return [sheet_controller_ saveDetailsLocally];
return [sheet_delegate_ saveDetailsLocally];
}
const content::NavigationController* AutofillDialogCocoa::ShowSignIn() {
return [sheet_controller_ showSignIn];
return [sheet_delegate_ showSignIn];
}
void AutofillDialogCocoa::HideSignIn() {
[sheet_controller_ hideSignIn];
[sheet_delegate_ hideSignIn];
}
void AutofillDialogCocoa::UpdateProgressBar(double value) {}
void AutofillDialogCocoa::ModelChanged() {
[sheet_controller_ modelChanged];
[sheet_delegate_ modelChanged];
}
void AutofillDialogCocoa::OnSignInResize(const gfx::Size& pref_size) {
......@@ -145,18 +145,18 @@ TestableAutofillDialogView* AutofillDialogCocoa::GetTestableView() {
}
void AutofillDialogCocoa::SubmitForTesting() {
[sheet_controller_ accept:nil];
[sheet_delegate_ accept:nil];
}
void AutofillDialogCocoa::CancelForTesting() {
[sheet_controller_ cancel:nil];
[sheet_delegate_ cancel:nil];
}
string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) {
for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
DialogSection section = static_cast<DialogSection>(i);
DetailOutputMap contents;
[sheet_controller_ getInputs:&contents forSection:section];
[sheet_delegate_ getInputs:&contents forSection:section];
DetailOutputMap::const_iterator it = contents.find(&input);
if (it != contents.end())
return it->second;
......@@ -168,30 +168,30 @@ string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) {
void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input,
const string16& contents) {
[sheet_controller_ setTextContents:base::SysUTF16ToNSString(contents)
[sheet_delegate_ setTextContents:base::SysUTF16ToNSString(contents)
forInput:input];
}
void AutofillDialogCocoa::SetTextContentsOfSuggestionInput(
DialogSection section,
const base::string16& text) {
[sheet_controller_ setTextContents:base::SysUTF16ToNSString(text)
[sheet_delegate_ setTextContents:base::SysUTF16ToNSString(text)
ofSuggestionForSection:section];
}
void AutofillDialogCocoa::ActivateInput(const DetailInput& input) {
[sheet_controller_ activateFieldForInput:input];
[sheet_delegate_ activateFieldForInput:input];
}
gfx::Size AutofillDialogCocoa::GetSize() const {
return gfx::Size(NSSizeToCGSize([[sheet_controller_ window] frame].size));
return gfx::Size(NSSizeToCGSize([[sheet_delegate_ window] frame].size));
}
void AutofillDialogCocoa::OnConstrainedWindowClosed(
ConstrainedWindowMac* window) {
constrained_window_.reset();
// |this| belongs to |controller_|, so no self-destruction here.
controller_->ViewClosed();
// |this| belongs to |delegate_|, so no self-destruction here.
delegate_->ViewClosed();
}
} // autofill
......@@ -220,12 +220,12 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
autofillDialog_ = autofillDialog;
mainContainer_.reset([[AutofillMainContainer alloc]
initWithController:autofillDialog->controller()]);
initWithDelegate:autofillDialog->delegate()]);
[mainContainer_ setTarget:self];
signInContainer_.reset(
[[AutofillSignInContainer alloc]
initWithController:autofillDialog->controller()]);
initWithDelegate:autofillDialog->delegate()]);
[[signInContainer_ view] setHidden:YES];
NSRect clientRect = [[mainContainer_ view] frame];
......@@ -239,7 +239,7 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
headerRect.origin.y = NSMaxY(clientRect);
accountChooser_.reset([[AutofillAccountChooser alloc]
initWithFrame:headerRect
controller:autofillDialog->controller()]);
delegate:autofillDialog->delegate()]);
// This needs a flipped content view because otherwise the size
// animation looks odd. However, replacing the contentView for constrained
......@@ -343,16 +343,16 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
- (IBAction)accept:(id)sender {
if ([mainContainer_ validate])
autofillDialog_->controller()->OnAccept();
autofillDialog_->delegate()->OnAccept();
}
- (IBAction)cancel:(id)sender {
autofillDialog_->controller()->OnCancel();
autofillDialog_->delegate()->OnCancel();
autofillDialog_->PerformClose();
}
- (void)hide {
autofillDialog_->controller()->OnCancel();
autofillDialog_->delegate()->OnCancel();
autofillDialog_->PerformClose();
}
......
......@@ -19,7 +19,7 @@
@class HyperlinkTextView;
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
// NSViewController for the main portion of the autofill dialog. Contains
......@@ -36,7 +36,7 @@ namespace autofill {
AutofillDialogWindowController* target_;
// Weak. Owns the dialog.
autofill::AutofillDialogController* controller_;
autofill::AutofillDialogViewDelegate* delegate_;
// Preferred size for legal documents.
NSSize legalDocumentsSize_;
......@@ -48,15 +48,15 @@ namespace autofill {
@property(assign, nonatomic) AutofillDialogWindowController* target;
// Designated initializer.
- (id)initWithController:(autofill::AutofillDialogController*)controller;
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
// Sets the anchor point for the notificationView_.
- (void)setAnchorView:(NSView*)anchorView;
// Returns the view controller responsible for |section|.
// Returns the view delegate responsible for |section|.
- (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
// Called when the controller-maintained suggestions model has changed.
// Called when the delegate-maintained suggestions model has changed.
- (void)modelChanged;
// Get status of "Save in Chrome" checkbox.
......
......@@ -9,7 +9,7 @@
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
......@@ -33,9 +33,9 @@
@synthesize target = target_;
- (id)initWithController:(autofill::AutofillDialogController*)controller {
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
if (self = [super init]) {
controller_ = controller;
delegate_ = delegate;
}
return self;
}
......@@ -54,13 +54,13 @@
saveInChromeCheckbox_.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
[saveInChromeCheckbox_ setButtonType:NSSwitchButton];
[saveInChromeCheckbox_ setTitle:
base::SysUTF16ToNSString(controller_->SaveLocallyText())];
base::SysUTF16ToNSString(delegate_->SaveLocallyText())];
[saveInChromeCheckbox_ setState:NSOnState];
[saveInChromeCheckbox_ sizeToFit];
[[self view] addSubview:saveInChromeCheckbox_];
detailsContainer_.reset(
[[AutofillDetailsContainer alloc] initWithController:controller_]);
[[AutofillDetailsContainer alloc] initWithDelegate:delegate_]);
NSSize frameSize = [[detailsContainer_ view] frame].size;
[[detailsContainer_ view] setFrameOrigin:
NSMakePoint(0, NSHeight([buttonContainer_ frame]))];
......@@ -83,7 +83,7 @@
[[self view] addSubview:legalDocumentsView_];
notificationContainer_.reset(
[[AutofillNotificationContainer alloc] initWithController:controller_]);
[[AutofillNotificationContainer alloc] initWithDelegate:delegate_]);
[[self view] addSubview:[notificationContainer_ view]];
}
......@@ -92,8 +92,8 @@
clickedOnLink:(id)link
atIndex:(NSUInteger)charIndex {
int index = [base::mac::ObjCCastStrict<NSNumber>(link) intValue];
controller_->LegalDocumentLinkClicked(
controller_->LegalDocumentLinks()[index]);
delegate_->LegalDocumentLinkClicked(
delegate_->LegalDocumentLinks()[index]);
return YES;
}
......@@ -230,7 +230,7 @@
}
- (void)modelChanged {
[saveInChromeCheckbox_ setHidden:!controller_->ShouldOfferToSaveInChrome()];
[saveInChromeCheckbox_ setHidden:!delegate_->ShouldOfferToSaveInChrome()];
[detailsContainer_ modelChanged];
}
......@@ -239,7 +239,7 @@
}
- (void)updateLegalDocuments {
NSString* text = base::SysUTF16ToNSString(controller_->LegalDocumentsText());
NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText());
if ([text length]) {
NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
......@@ -248,7 +248,7 @@
messageColor:[NSColor blackColor]];
const std::vector<ui::Range>& link_ranges =
controller_->LegalDocumentLinks();
delegate_->LegalDocumentLinks();
for (size_t i = 0; i < link_ranges.size(); ++i) {
NSRange range = link_ranges[i].ToNSRange();
[legalDocumentsView_ addLinkRange:range
......@@ -260,16 +260,16 @@
[legalDocumentsView_ setHidden:[text length] == 0];
// Always request re-layout on state change.
id controller = [[[self view] window] windowController];
if ([controller respondsToSelector:@selector(requestRelayout)])
[controller performSelector:@selector(requestRelayout)];
id delegate = [[[self view] window] windowController];
if ([delegate respondsToSelector:@selector(requestRelayout)])
[delegate performSelector:@selector(requestRelayout)];
}
- (void)updateNotificationArea {
[notificationContainer_ setNotifications:controller_->CurrentNotifications()];
id controller = [[[self view] window] windowController];
if ([controller respondsToSelector:@selector(requestRelayout)])
[controller performSelector:@selector(requestRelayout)];
[notificationContainer_ setNotifications:delegate_->CurrentNotifications()];
id delegate = [[[self view] window] windowController];
if ([delegate respondsToSelector:@selector(requestRelayout)])
[delegate performSelector:@selector(requestRelayout)];
}
- (void)setAnchorView:(NSView*)anchorView {
......
......@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
#include "base/mac/scoped_nsobject.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
......@@ -17,14 +17,14 @@ class AutofillMainContainerTest : public ui::CocoaTest {
public:
virtual void SetUp() {
CocoaTest::SetUp();
container_.reset([[AutofillMainContainer alloc] initWithController:
&controller_]);
container_.reset([[AutofillMainContainer alloc] initWithDelegate:
&delegate_]);
[[test_window() contentView] addSubview:[container_ view]];
}
protected:
base::scoped_nsobject<AutofillMainContainer> container_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
};
} // namespace
......@@ -76,8 +76,8 @@ TEST_F(AutofillMainContainerTest, SaveDetailsLocallyDefaultsToTrue) {
TEST_F(AutofillMainContainerTest, SaveInChromeCheckboxVisibility) {
using namespace testing;
// Tests that the checkbox is only visible if the controller allows it.
EXPECT_CALL(controller_, ShouldOfferToSaveInChrome()).Times(2)
// Tests that the checkbox is only visible if the delegate allows it.
EXPECT_CALL(delegate_, ShouldOfferToSaveInChrome()).Times(2)
.WillOnce(Return(false))
.WillOnce(Return(true));
......
......@@ -18,7 +18,7 @@
namespace autofill {
class DialogNotification;
typedef std::vector<DialogNotification> DialogNotifications;
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
// Container for all notifications shown in requestAutocomplete dialog.
......@@ -33,12 +33,12 @@ namespace autofill {
// The notification that the checkbox is associated with.
scoped_ptr<autofill::DialogNotification> checkboxNotification_;
// Main controller for the dialog. Weak, owns dialog.
autofill::AutofillDialogController* controller_;
// Main delegate for the dialog. Weak, owns dialog.
autofill::AutofillDialogViewDelegate* delegate_;
}
// Designated initializer.
- (id)initWithController:(autofill::AutofillDialogController*)controller;
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
// Computes the views preferred size given a fixed width.
- (NSSize)preferredSizeForWidth:(CGFloat)width;
......@@ -54,4 +54,4 @@ namespace autofill {
@end
#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTAINER_H_
\ No newline at end of file
#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTAINER_H_
......@@ -7,17 +7,17 @@
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_notification_controller.h"
#include "skia/ext/skia_utils_mac.h"
@implementation AutofillNotificationContainer
- (id)initWithController:(autofill::AutofillDialogController*)controller {
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
if (self = [super init]) {
controller_ = controller;
delegate_ = delegate;
[self setView:[[[NSView alloc] initWithFrame:NSZeroRect] autorelease]];
}
return self;
......@@ -39,9 +39,9 @@
if (![[notificationControllers_ objectAtIndex:0] hasArrow])
preferredSize.height += kArrowHeight;
for (AutofillNotificationController* controller in
for (AutofillNotificationController* delegate in
notificationControllers_.get())
preferredSize.height += [controller preferredSizeForWidth:width].height;
preferredSize.height += [delegate preferredSizeForWidth:width].height;
return preferredSize;
}
......@@ -55,13 +55,13 @@
if (![[notificationControllers_ objectAtIndex:0] hasArrow])
remaining.size.height -= kArrowHeight;
for (AutofillNotificationController* controller in
for (AutofillNotificationController* delegate in
notificationControllers_.get()) {
NSRect viewRect;
NSSize size = [controller preferredSizeForWidth:NSWidth(remaining)];
NSSize size = [delegate preferredSizeForWidth:NSWidth(remaining)];
NSDivideRect(remaining, &viewRect, &remaining, size.height, NSMaxYEdge);
[[controller view ] setFrame:viewRect];
[controller performLayout];
[[delegate view ] setFrame:viewRect];
[delegate performLayout];
}
DCHECK_EQ(0, NSHeight(remaining));
}
......@@ -114,7 +114,7 @@
- (IBAction)checkboxClicked:(id)sender {
DCHECK(checkboxNotification_);
BOOL isChecked = ([sender state] == NSOnState);
controller_->NotificationCheckboxStateChanged(checkboxNotification_->type(),
delegate_->NotificationCheckboxStateChanged(checkboxNotification_->type(),
isChecked);
}
......
......@@ -7,7 +7,7 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "ui/base/test/ui_cocoa_test_helper.h"
......@@ -17,14 +17,14 @@ class AutofillNotificationContainerTest : public ui::CocoaTest {
public:
virtual void SetUp() {
CocoaTest::SetUp();
container_.reset([[AutofillNotificationContainer alloc] initWithController:
&controller_]);
container_.reset([[AutofillNotificationContainer alloc] initWithDelegate:
&delegate_]);
[[test_window() contentView] addSubview:[container_ view]];
}
protected:
base::scoped_nsobject<AutofillNotificationContainer> container_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
};
} // namespace
......@@ -58,4 +58,4 @@ TEST_F(AutofillNotificationContainerTest, Subviews) {
// Just to exercise code path.
[container_ performLayout];
}
\ No newline at end of file
}
......@@ -14,7 +14,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
@class AutofillSectionView;
......@@ -32,9 +32,9 @@ namespace autofill {
@end
// View controller for a section of the payment details. Contains a label
// View delegate for a section of the payment details. Contains a label
// describing the section as well as associated inputs and controls. Built
// dynamically based on data retrieved from AutofillDialogController.
// dynamically based on data retrieved from AutofillDialogViewDelegate.
@interface AutofillSectionContainer :
NSViewController<AutofillLayout, AutofillInputDelegate> {
@private
......@@ -54,21 +54,21 @@ namespace autofill {
base::scoped_nsobject<MenuController> menuController_;
autofill::DialogSection section_;
autofill::AutofillDialogController* controller_; // Not owned.
autofill::AutofillDialogViewDelegate* delegate_; // Not owned.
}
@property(readonly, nonatomic) autofill::DialogSection section;
@property(assign, nonatomic) id<AutofillValidationDisplay> validationDelegate;
// Designated initializer. Queries |controller| for the list of desired input
// Designated initializer. Queries |delegate| for the list of desired input
// fields for |section|.
- (id)initWithController:(autofill::AutofillDialogController*)controller
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate
forSection:(autofill::DialogSection)section;
// Populates |output| with mappings from field identification to input value.
- (void)getInputs:(autofill::DetailOutputMap*)output;
// Called when the controller-maintained suggestions model has changed.
// Called when the delegate-maintained suggestions model has changed.
- (void)modelChanged;
// Called when the contents of a section have changed.
......
......@@ -8,7 +8,7 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h"
#import "chrome/browser/ui/cocoa/autofill/layout_view.h"
#import "chrome/browser/ui/cocoa/menu_button.h"
......@@ -33,14 +33,14 @@ class AutofillSectionContainerTest : public ui::CocoaTest {
void ResetContainer() {
container_.reset(
[[AutofillSectionContainer alloc]
initWithController:&controller_
initWithDelegate:&delegate_
forSection:section_]);
[[test_window() contentView] setSubviews:@[ [container_ view] ]];
}
protected:
base::scoped_nsobject<AutofillSectionContainer> container_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
autofill::DialogSection section_;
};
......@@ -85,9 +85,9 @@ TEST_F(AutofillSectionContainerTest, ModelsPopulateComboboxes) {
inputs.push_back(kTestInputs[0]);
autofill::MonthComboboxModel comboModel;
EXPECT_CALL(controller_, RequestedFieldsForSection(section_))
EXPECT_CALL(delegate_, RequestedFieldsForSection(section_))
.WillOnce(ReturnRef(inputs));
EXPECT_CALL(controller_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
.WillRepeatedly(Return(&comboModel));
ResetContainer();
......@@ -114,11 +114,11 @@ TEST_F(AutofillSectionContainerTest, OutputMatchesDefinition) {
inputs.push_back(kTestInputs[0]);
inputs.push_back(kTestInputs[1]);
EXPECT_CALL(controller_, RequestedFieldsForSection(section_))
EXPECT_CALL(delegate_, RequestedFieldsForSection(section_))
.WillOnce(ReturnRef(inputs));
EXPECT_CALL(controller_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
.WillRepeatedly(ReturnNull());
EXPECT_CALL(controller_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
.WillRepeatedly(Return(&comboModel));
ResetContainer();
......@@ -144,7 +144,7 @@ TEST_F(AutofillSectionContainerTest, SuggestionsPopulatedByController) {
using namespace autofill;
using namespace testing;
EXPECT_CALL(controller_, MenuModelForSection(section_))
EXPECT_CALL(delegate_, MenuModelForSection(section_))
.WillOnce(Return(&model));
ResetContainer();
......@@ -178,11 +178,11 @@ TEST_F(AutofillSectionContainerTest, FieldsAreInitiallyValid) {
inputs.push_back(kTestInputs[0]);
inputs.push_back(kTestInputs[1]);
EXPECT_CALL(controller_, RequestedFieldsForSection(section_))
EXPECT_CALL(delegate_, RequestedFieldsForSection(section_))
.WillOnce(ReturnRef(inputs));
EXPECT_CALL(controller_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
.WillRepeatedly(ReturnNull());
EXPECT_CALL(controller_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
.WillRepeatedly(Return(&comboModel));
ResetContainer();
......@@ -211,16 +211,16 @@ TEST_F(AutofillSectionContainerTest, ControllerInformsValidity) {
validity[EMAIL_ADDRESS] = ASCIIToUTF16("Some error message");
validity2[CREDIT_CARD_EXP_MONTH ] = ASCIIToUTF16("Some other error message");
EXPECT_CALL(controller_, RequestedFieldsForSection(section_))
EXPECT_CALL(delegate_, RequestedFieldsForSection(section_))
.WillOnce(ReturnRef(inputs));
EXPECT_CALL(controller_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(EMAIL_ADDRESS))
.WillRepeatedly(ReturnNull());
EXPECT_CALL(controller_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
EXPECT_CALL(delegate_, ComboboxModelForAutofillType(CREDIT_CARD_EXP_MONTH))
.WillRepeatedly(Return(&comboModel));
ResetContainer();
[container_ getInputs:&output];
EXPECT_CALL(controller_, InputsAreValid(section_, output, VALIDATE_FINAL))
EXPECT_CALL(delegate_, InputsAreValid(section_, output, VALIDATE_FINAL))
.WillOnce(Return(validity))
.WillOnce(Return(validity2));
......@@ -236,4 +236,4 @@ TEST_F(AutofillSectionContainerTest, ControllerInformsValidity) {
EXPECT_FALSE([field invalid]);
field = [container_ getField:CREDIT_CARD_EXP_MONTH];
EXPECT_TRUE([field invalid]);
}
\ No newline at end of file
}
......@@ -10,7 +10,7 @@
#include "base/memory/scoped_ptr.h"
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
namespace content {
......@@ -21,11 +21,11 @@ namespace content {
// Controls the sign-in dialog of the AutofillDialog.
@interface AutofillSignInContainer : NSViewController {
@private
autofill::AutofillDialogController* controller_; // Not owned.
autofill::AutofillDialogViewDelegate* delegate_; // Not owned.
scoped_ptr<content::WebContents> webContents_;
}
- (id)initWithController:(autofill::AutofillDialogController*)controller;
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
- (void)loadSignInPage;
- (content::NavigationController*)navigationController;
......
......@@ -8,16 +8,16 @@
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "components/autofill/content/browser/wallet/wallet_service_url.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@implementation AutofillSignInContainer
- (id)initWithController:(autofill::AutofillDialogController*)controller {
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
if (self = [super init]) {
controller_ = controller;
delegate_ = delegate;
}
return self;
}
......@@ -25,7 +25,7 @@
- (void)loadView {
webContents_.reset(
content::WebContents::Create(
content::WebContents::CreateParams(controller_->profile())));
content::WebContents::CreateParams(delegate_->profile())));
NSView* webContentView = webContents_->GetView()->GetNativeView();
[self setView:webContentView];
}
......
......@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h"
#include "base/mac/scoped_nsobject.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
......@@ -34,8 +34,8 @@ class AutofillSignInContainerTest : public ChromeRenderViewHostTestHarness {
// from from CocoaTest, so do a bootstrap and create test window.
CocoaTest::BootstrapCocoa();
container_.reset(
[[AutofillSignInContainer alloc] initWithController:&controller_]);
EXPECT_CALL(controller_, profile())
[[AutofillSignInContainer alloc] initWithDelegate:&delegate_]);
EXPECT_CALL(delegate_, profile())
.WillOnce(testing::Return(this->profile()));
[[test_window() contentView] addSubview:[container_ view]];
}
......@@ -61,7 +61,7 @@ class AutofillSignInContainerTest : public ChromeRenderViewHostTestHarness {
protected:
base::scoped_nsobject<AutofillSignInContainer> container_;
testing::NiceMock<autofill::MockAutofillDialogController> controller_;
testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
CocoaTestHelperWindow* test_window_;
};
......
......@@ -11,7 +11,7 @@
#import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
namespace autofill {
class AutofillDialogController;
class AutofillDialogViewDelegate;
}
@class AutofillTextField;
......@@ -31,7 +31,7 @@ namespace autofill {
// The input set by ShowTextfield.
base::scoped_nsobject<AutofillTextField> inputField_;
autofill::AutofillDialogController* controller_; // Not owned.
autofill::AutofillDialogViewDelegate* delegate_; // Not owned.
}
// Auxiliary textfield. See showTextfield: for details.
......
......@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h"
#include "skia/ext/skia_utils_mac.h"
......
......@@ -10,8 +10,8 @@
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/views/controls/button/button.h"
......@@ -74,7 +74,7 @@ class AutofillDialogViews : public AutofillDialogView,
public views::ComboboxListener,
public views::StyledLabelListener {
public:
explicit AutofillDialogViews(AutofillDialogController* controller);
explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate);
virtual ~AutofillDialogViews();
// AutofillDialogView implementation:
......@@ -203,10 +203,10 @@ class AutofillDialogViews : public AutofillDialogView,
public views::LinkListener,
public base::SupportsWeakPtr<AccountChooser> {
public:
explicit AccountChooser(AutofillDialogController* controller);
explicit AccountChooser(AutofillDialogViewDelegate* delegate);
virtual ~AccountChooser();
// Updates the view based on the state that |controller_| reports.
// Updates the view based on the state that |delegate_| reports.
void Update();
// views::View implementation.
......@@ -229,8 +229,8 @@ class AutofillDialogViews : public AutofillDialogView,
// The sign in link.
views::Link* link_;
// The controller |this| queries for logic and state.
AutofillDialogController* controller_;
// The delegate |this| queries for logic and state.
AutofillDialogViewDelegate* delegate_;
// Runs the suggestion menu (triggered by each section's |suggested_button|.
scoped_ptr<views::MenuRunner> menu_runner_;
......@@ -296,7 +296,7 @@ class AutofillDialogViews : public AutofillDialogView,
class NotificationArea : public views::View,
public views::ButtonListener {
public:
explicit NotificationArea(AutofillDialogController* controller);
explicit NotificationArea(AutofillDialogViewDelegate* delegate);
virtual ~NotificationArea();
// Displays the given notifications.
......@@ -322,9 +322,9 @@ class AutofillDialogViews : public AutofillDialogView,
// pointing at |arrow_centering_anchor_|.
bool HasArrow();
// A reference to the controller than owns this view. Used to report when
// checkboxes change their values.
AutofillDialogController* controller_; // weak
// A reference to the delegate/controller than owns this view.
// Used to report when checkboxes change their values.
AutofillDialogViewDelegate* delegate_; // weak
// The currently showing checkbox, or NULL if none exists.
views::Checkbox* checkbox_; // weak
......@@ -493,7 +493,7 @@ class AutofillDialogViews : public AutofillDialogView,
// returned.
views::View* InitInputsView(DialogSection section);
// Updates the given section to match the state provided by |controller_|. If
// Updates the given section to match the state provided by |delegate_|. If
// |clobber_inputs| is true, the current state of the textfields will be
// ignored, otherwise their contents will be preserved.
void UpdateSectionImpl(DialogSection section, bool clobber_inputs);
......@@ -532,7 +532,7 @@ class AutofillDialogViews : public AutofillDialogView,
bool ValidateForm();
// When an input textfield is edited (its contents change) or activated
// (clicked while focused), this function will inform the controller that it's
// (clicked while focused), this function will inform the delegate that it's
// time to show a suggestion popup and possibly reset the validity state of
// the input.
void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit);
......@@ -554,8 +554,8 @@ class AutofillDialogViews : public AutofillDialogView,
// Called when the details container changes in size or position.
void DetailsContainerBoundsChanged();
// The controller that drives this view. Weak pointer, always non-NULL.
AutofillDialogController* const controller_;
// The delegate that drives this view. Weak pointer, always non-NULL.
AutofillDialogViewDelegate* const delegate_;
// The window that displays |contents_|. Weak pointer; may be NULL when the
// dialog is closing.
......
......@@ -280,7 +280,6 @@
'browser/ui/autofill/autofill_credit_card_bubble.h',
'browser/ui/autofill/autofill_credit_card_bubble_controller.cc',
'browser/ui/autofill/autofill_credit_card_bubble_controller.h',
'browser/ui/autofill/autofill_dialog_controller.h',
'browser/ui/autofill/autofill_dialog_controller_impl.cc',
'browser/ui/autofill/autofill_dialog_controller_impl.h',
'browser/ui/autofill/autofill_dialog_models.cc',
......@@ -291,6 +290,7 @@
'browser/ui/autofill/autofill_dialog_types.h',
'browser/ui/autofill/autofill_dialog_view.cc',
'browser/ui/autofill/autofill_dialog_view.h',
'browser/ui/autofill/autofill_dialog_view_delegate.h',
'browser/ui/autofill/autofill_popup_controller.h',
'browser/ui/autofill/autofill_popup_controller_impl.cc',
'browser/ui/autofill/autofill_popup_controller_impl.h',
......
......@@ -1346,8 +1346,8 @@
'browser/ui/autofill/autofill_dialog_types_unittest.cc',
'browser/ui/autofill/autofill_popup_controller_unittest.cc',
'browser/ui/autofill/data_model_wrapper_unittest.cc',
'browser/ui/autofill/mock_autofill_dialog_controller.cc',
'browser/ui/autofill/mock_autofill_dialog_controller.h',
'browser/ui/autofill/mock_autofill_dialog_view_delegate.cc',
'browser/ui/autofill/mock_autofill_dialog_view_delegate.h',
'browser/ui/autofill/test_autofill_credit_card_bubble.cc',
'browser/ui/autofill/test_autofill_credit_card_bubble.h',
'browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment