diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-11 21:47:01 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-11 21:47:01 +0000 |
commit | 394aa59248445297e01bf09acc40c2ff0fb34999 (patch) | |
tree | e9549ea2649db32eba6ddb39e277ddbd3e34b492 /chrome/browser/cocoa/toolbar_controller.mm | |
parent | 2afc8336851ae77cfc681c8823d1c478364a4cd3 (diff) | |
download | chromium_src-394aa59248445297e01bf09acc40c2ff0fb34999.zip chromium_src-394aa59248445297e01bf09acc40c2ff0fb34999.tar.gz chromium_src-394aa59248445297e01bf09acc40c2ff0fb34999.tar.bz2 |
Use Chrome facilities for omnibox state save and restore on Mac.
TabContents has a facility for storing a bag of stuff across
current-tab changes. Wire up AutocompleteEditViewMac to use that
facility. Unfork some code in Browser::TabSelectedAt() so that the
new code gets used, and straighten up the Mac code along the code path
between there and AutocompleteEditViewMac.
This overall change also exposed a couple bugs/mis-features in the
AutocompleteEditViewMac code.
TEST=Text field maintains contents and selection across tab changes, even when edited.
Review URL: http://codereview.chromium.org/114017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index d2a986e..0860a0b 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_)); - [locationBar_ setStringValue:@"http://dev.chromium.org"]; } - (void)dealloc { @@ -98,27 +97,9 @@ static NSString* const kStarredImageName = @"starred"; [starButton_ setEnabled:commands->IsCommandEnabled(IDC_STAR) ? YES : NO]; } -- (void)updateToolbarWithContents:(TabContents*)tab { - // TODO(pinkerton): there's a lot of ui code in autocomplete_edit.cc - // that we'll want to duplicate. For now, just handle setting the text. - - // TODO(shess): This is the start of what pinkerton refers to. - // Unfortunately, I'm going to need to spend some time wiring things - // up. This call should suffice to close any open autocomplete - // pulldown. It should also be the right thing to do to save and - // restore state, but at this time it's not clear that this is the - // right place, and tab is not the right parameter. - if (locationBarView_.get()) { - locationBarView_->SaveStateToContents(NULL); - } - - // TODO(pinkerton): update the security lock icon and background color - - // TODO(shess): Determine whether this should happen via - // locationBarView_, instead, in which case this class can - // potentially lose the locationBar_ reference. - NSString* urlString = base::SysWideToNSString(toolbarModel_->GetText()); - [locationBar_ setStringValue:urlString]; +- (void)updateToolbarWithContents:(TabContents*)tab + shouldRestoreState:(BOOL)shouldRestore { + locationBarView_->Update(tab, shouldRestore ? true : false); } - (void)setStarredState:(BOOL)isStarred { |