From 30179058aa633f1052869d75936a09dd8e7b9cf7 Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Tue, 12 Oct 2010 01:34:18 +0000 Subject: [Mac] Initial Instant implementation. This is a very rough cut. Many things are still unfinished and will be fixed in future CLs: - Clicking on instant results clears the results. - Suggestions do not work yet. - The omnibox popup overlaps with instant results. - HTTP auth dialogs cause crashes. BUG=56385 TEST=No visible impact when --enable-match-preview is not set on the command line. TEST=Instant results should appear when typing in the omnibox. TEST=Instant results should disappear when clicking outside the browser window or clicking on devtools or the sidebar. Review URL: http://codereview.chromium.org/3624001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62221 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/browser_window_controller.mm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'chrome/browser/cocoa/browser_window_controller.mm') diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index f2fc066d..86f3b5e 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1372,6 +1372,11 @@ } - (void)onReplaceTabWithContents:(TabContents*)contents { + // This is only called when instant results are committed. Simply remove the + // preview view; the tab strip controller will reinstall the view as the + // active view. + [previewableContentsController_ hidePreview]; + [self updateBookmarkBarVisibilityWithAnimation:NO]; } - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change { @@ -1718,6 +1723,21 @@ willAnimateFromState:(bookmarks::VisualState)oldState return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); } +- (void)showInstant:(TabContents*)previewContents { + [previewableContentsController_ showPreview:previewContents]; + [self updateBookmarkBarVisibilityWithAnimation:NO]; +} + +- (void)hideInstant { + // TODO(rohitrao): Revisit whether or not this method should be called when + // instant isn't showing. + if (![previewableContentsController_ isShowingPreview]) + return; + + [previewableContentsController_ hidePreview]; + [self updateBookmarkBarVisibilityWithAnimation:NO]; +} + - (void)sheetDidEnd:(NSWindow*)sheet returnCode:(NSInteger)code context:(void*)context { -- cgit v1.1