diff options
7 files changed, 16 insertions, 49 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index d6b0928..19f4b31 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -32,7 +32,8 @@ class AutocompleteEditViewMac : public AutocompleteEditView { AutocompleteEditViewMac(AutocompleteEditController* controller, ToolbarModel* toolbar_model, Profile* profile, - CommandUpdater* command_updater); + CommandUpdater* command_updater, + NSTextField* field); virtual ~AutocompleteEditViewMac(); // Implement the AutocompleteEditView interface. @@ -88,10 +89,6 @@ class AutocompleteEditViewMac : public AutocompleteEditView { void OnKillFocus(); void AcceptInput(WindowOpenDisposition disposition, bool for_drop); - // TODO(shess): Get rid of this. Right now it's needed because of - // the ordering of initialization in tab_contents_controller.mm. - void SetField(NSTextField* field); - // Helper for LocationBarBridge. void FocusLocation(); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 71b6d24..854f3dc 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -23,18 +23,22 @@ AutocompleteEditViewMac::AutocompleteEditViewMac( AutocompleteEditController* controller, ToolbarModel* toolbar_model, Profile* profile, - CommandUpdater* command_updater) + CommandUpdater* command_updater, + NSTextField* field) : model_(new AutocompleteEditModel(this, controller, profile)), - popup_view_(new AutocompletePopupViewMac(this, model_.get(), profile)), + popup_view_(new AutocompletePopupViewMac(this, model_.get(), profile, + field)), controller_(controller), toolbar_model_(toolbar_model), command_updater_(command_updater), - field_(nil), + field_(field), edit_helper_([[AutocompleteFieldDelegate alloc] initWithEditView:this]) { DCHECK(controller); DCHECK(toolbar_model); DCHECK(profile); DCHECK(command_updater); + DCHECK(field); + [field_ setDelegate:edit_helper_]; } AutocompleteEditViewMac::~AutocompleteEditViewMac() { @@ -273,13 +277,6 @@ void AutocompleteEditViewMac::AcceptInput( WindowOpenDisposition disposition, bool for_drop) { model_->AcceptInput(disposition, for_drop); } -void AutocompleteEditViewMac::SetField(NSTextField* field) { - field_ = field; - [field_ setDelegate:edit_helper_]; - - // The popup code needs the field for sizing and placement. - popup_view_->SetField(field_); -} void AutocompleteEditViewMac::FocusLocation() { [[field_ window] makeFirstResponder:field_]; diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h index 376260a..9cb2af7 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h @@ -29,7 +29,8 @@ class AutocompletePopupViewMac : public AutocompletePopupView { public: AutocompletePopupViewMac(AutocompleteEditViewMac* edit_view, AutocompleteEditModel* edit_model, - Profile* profile); + Profile* profile, + NSTextField* field); virtual ~AutocompletePopupViewMac(); // Implement the AutocompletePopupView interface. @@ -73,12 +74,6 @@ class AutocompletePopupViewMac : public AutocompletePopupView { const std::wstring& ResultDescriptionAt(size_t i); void AcceptInput(WindowOpenDisposition disposition, bool for_drop); - // TODO(shess): Get rid of this. Right now it's needed because of - // the ordering of initialization in tab_contents_controller.mm. - void SetField(NSTextField* field) { - field_ = field; - } - private: // Create the popup_ instance if needed. void CreatePopupIfNeeded(); diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm index bdf7372..f1dbc8e 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm @@ -36,10 +36,11 @@ objectValueForTableColumn:(NSTableColumn*)aTableColumn AutocompletePopupViewMac::AutocompletePopupViewMac( AutocompleteEditViewMac* edit_view, AutocompleteEditModel* edit_model, - Profile* profile) + Profile* profile, + NSTextField* field) : model_(new AutocompletePopupModel(this, edit_model, profile)), edit_view_(edit_view), - field_(nil), + field_(field), table_target_([[AutocompleteTableTarget alloc] initWithPopupView:this]), popup_(nil) { DCHECK(edit_view); diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h index d8188ee..90cb2a6 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.h +++ b/chrome/browser/cocoa/location_bar_view_mac.h @@ -28,13 +28,6 @@ class LocationBarViewMac : public AutocompleteEditController, Profile* profile); virtual ~LocationBarViewMac(); - // TODO(shess): This is a placeholder for the Omnibox code. The - // problem it will paper over is that Profile availability does not - // match object creation in TabContentsController. Circle back and - // resolve this after the Profile-handling and tab logic changes are - // complete. - void Init(); - // Overridden from LocationBar virtual void ShowFirstRunBubble() { NOTIMPLEMENTED(); } virtual std::wstring GetInputString() const; @@ -60,10 +53,7 @@ class LocationBarViewMac : public AutocompleteEditController, private: scoped_ptr<AutocompleteEditViewMac> edit_view_; - NSTextField* field_; // weak, owned by ToolbarController nib CommandUpdater* command_updater_; // weak, owned by Browser - ToolbarModel* toolbar_model_; // weak, owned by Browser - Profile* profile_; // weak, outlives the Browser // When we get an OnAutocompleteAccept notification from the autocomplete // edit, we save the input string so we can give it back to the browser on diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm index d653201..d9217ec 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar_view_mac.mm @@ -19,10 +19,9 @@ LocationBarViewMac::LocationBarViewMac(NSTextField* field, CommandUpdater* command_updater, ToolbarModel* toolbar_model, Profile* profile) - : field_(field), + : edit_view_(new AutocompleteEditViewMac(this, toolbar_model, profile, + command_updater, field)), command_updater_(command_updater), - toolbar_model_(toolbar_model), - profile_(profile), disposition_(CURRENT_TAB), transition_(PageTransition::TYPED) { } @@ -31,17 +30,6 @@ LocationBarViewMac::~LocationBarViewMac() { // TODO(shess): Placeholder for omnibox changes. } -void LocationBarViewMac::Init() { - // TODO(shess): Get rid of Init() so we don't have to cache all these members - // as we don't use them beyond this method. - edit_view_.reset(new AutocompleteEditViewMac(this, - toolbar_model_, - profile_, - command_updater_)); - // TODO(shess): Include in constructor. - edit_view_->SetField(field_); -} - std::wstring LocationBarViewMac::GetInputString() const { return location_input_; } diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index 9cd7739..d2a986e 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -48,7 +48,6 @@ static NSString* const kStarredImageName = @"starred"; [self initCommandStatus:commands_]; locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_, toolbarModel_, profile_)); - locationBarView_->Init(); [locationBar_ setStringValue:@"http://dev.chromium.org"]; } |