Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5314)

Unified Diff: chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm

Issue 12631008: alternate ntp: implement Show/HideBars API to reduce jank when showing/hiding bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed build break Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/search/search_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
diff --git a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
index 13bad50e89dc6abbbe84705b758654737cc3c42c..68006c7a7f36a98032a5f96483dc19c511b0030a 100644
--- a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
@@ -2,11 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h"
+
+#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/browser.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h"
#import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
#include "chrome/browser/ui/search/instant_overlay_model.h"
+#include "chrome/browser/ui/search/search_model.h"
+#include "chrome/browser/ui/search/search_tab_helper.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
InstantOverlayControllerMac::InstantOverlayControllerMac(
Browser* browser,
@@ -22,6 +28,11 @@ InstantOverlayControllerMac::~InstantOverlayControllerMac() {
void InstantOverlayControllerMac::OverlayStateChanged(
const InstantOverlayModel& model) {
+ // TODO(sail): migrate from InstantOverlayControllerViews::OverlayStateChanged
+ // to only call SetTopBarsVisible if we did something with overlay; this
+ // prevents the top bars from flashing in this transition
+ // DEFAULT->SUGGESTIONS->SERP.
+ bool has_overlay = false;
if (model.mode().is_ntp() || model.mode().is_search_suggestions()) {
// Drop shadow is only needed if search mode is not |NTP| and overlay does
// not fill up the entire contents page.
@@ -32,12 +43,24 @@ void InstantOverlayControllerMac::OverlayStateChanged(
height:model.height()
heightUnits:model.height_units()
drawDropShadow:drawDropShadow];
+ has_overlay = true;
} else {
[overlay_ setOverlay:NULL
height:0
heightUnits:INSTANT_SIZE_PIXELS
drawDropShadow:NO];
}
- browser_->MaybeUpdateBookmarkBarStateForInstantOverlay(model.mode());
+
+ if (chrome::search::IsInstantExtendedAPIEnabled()) {
+ // Set top bars (bookmark and info bars) visibility for current tab via
+ // |SearchTabHelper| of current active web contents: top bars are hidden if
+ // there's overlay.
+ chrome::search::SearchTabHelper* search_tab_helper =
+ chrome::search::SearchTabHelper::FromWebContents(
+ browser_->tab_strip_model()->GetActiveWebContents());
+ if (search_tab_helper)
+ search_tab_helper->model()->SetTopBarsVisible(!has_overlay);
+ }
+
[window_ updateBookmarkBarStateForInstantOverlay];
}
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/search/search_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698