From e8c4e753d0a2bcdac816d472d9afa50fdafae7ba Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Mon, 27 Apr 2009 20:06:29 +0000 Subject: Clean up construction of LocationBarViewMac objects. This removes the need for SetField() accessors on AutocompleteEditViewMac and AutocompletePopupViewMac, and also removes the Init() wart on LocationBarViewMac. Now everything is wired up in the constructor. Review URL: http://codereview.chromium.org/92136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14641 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/location_bar_view_mac.h | 10 ---------- chrome/browser/cocoa/location_bar_view_mac.mm | 16 ++-------------- chrome/browser/cocoa/toolbar_controller.mm | 1 - 3 files changed, 2 insertions(+), 25 deletions(-) (limited to 'chrome/browser/cocoa') 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 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"]; } -- cgit v1.1