diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 22:51:11 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 22:51:11 +0000 |
commit | 5856887365d0b2a48ed2c5d160b50904959edb59 (patch) | |
tree | 8684e18b08031dff4a953a3c07f63795bbbdb729 /chrome/browser/cocoa/tab_strip_controller.mm | |
parent | e713032402418e679b6ad93f75ac33e879b9ceee (diff) | |
download | chromium_src-5856887365d0b2a48ed2c5d160b50904959edb59.zip chromium_src-5856887365d0b2a48ed2c5d160b50904959edb59.tar.gz chromium_src-5856887365d0b2a48ed2c5d160b50904959edb59.tar.bz2 |
Initial implemention of Mac Omnibox.
AutocompletePopupViewMac implements AutocompletePopupView in terms of a bare NSWindow containing an NSTableView. AutocompleteTableTarget implements an Obj-C class to bridge from appkit callbacks back to the popup view (and from there to the model which contains the data it needs).
AutocompleteEditViewMac implements AutocompleteEditView in terms of an NSTextField, which is passed down from a nib owner. It works with the popup view to make sure the popup is positioned correctly. AutocompleteFieldDelegate is an internal Obj-C class to bridge from appkit callbacks back to the edit view (and then the edit model).
LocationBarViewMac implements LocationBar for interacting with the rest of the browser, and AutocompleteEditController for managing the edit and popup views. It is mostly placeholder code stolen from the gtk implementation.
---
I've tried to implement an amount of code which worked and was useful, but which didn't drag on and on into the future. So no tab to search or hints or anything, sometimes ugly, selection may be funky, etc.
Review URL: http://codereview.chromium.org/50074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_strip_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index 46a98df..28678d7 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -295,6 +295,14 @@ class TabStripBridge : public TabStripModelObserver { previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture { + int selectedIndex = 0; + for (TabController* current in tabArray_) { + if ([current selected]) { + break; + } + ++selectedIndex; + } + // De-select all other tabs and select the new tab. int i = 0; for (TabController* current in tabArray_) { @@ -306,6 +314,13 @@ class TabStripBridge : public TabStripModelObserver { NSView* selectedTab = [self viewAtIndex:index]; [tabView_ addSubview:selectedTab positioned:NSWindowAbove relativeTo:nil]; + // Tell the current tab to lose focus. + if (selectedIndex < (int)[tabArray_ count]) { + TabContentsController* selectedController = + [tabContentsArray_ objectAtIndex:selectedIndex]; + [selectedController defocusLocationBar]; + } + // Tell the new tab contents it is about to become the selected tab. Here it // can do things like make sure the toolbar is up to date. TabContentsController* newController = |