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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 11876036: Alternate NTP: Don't hide bookmark bar on instant (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 } else { 2229 } else {
2230 WebContents* web_contents = tab_strip_model_->GetActiveWebContents(); 2230 WebContents* web_contents = tab_strip_model_->GetActiveWebContents();
2231 BookmarkTabHelper* bookmark_tab_helper = 2231 BookmarkTabHelper* bookmark_tab_helper =
2232 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL; 2232 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL;
2233 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar()) 2233 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar())
2234 state = BookmarkBar::DETACHED; 2234 state = BookmarkBar::DETACHED;
2235 else 2235 else
2236 state = BookmarkBar::HIDDEN; 2236 state = BookmarkBar::HIDDEN;
2237 } 2237 }
2238 2238
2239
dhollowa 2013/01/17 17:47:58 nit: extra line
sail 2013/01/17 18:17:12 Done.
2239 // Don't allow the bookmark bar to be shown in suggestions mode or 2240 // Don't allow the bookmark bar to be shown in suggestions mode or
2240 // for instant extended api, non-NTP modes when it's detached. 2241 // for instant extended api, non-NTP modes when it's detached.
2242 // TODO(sail): Stop hidding the bookmark bar on other platforms.
2243 #if !defined(OS_MACOSX)
2241 if (search_model_->mode().is_search_suggestions() || 2244 if (search_model_->mode().is_search_suggestions() ||
2242 (chrome::search::IsInstantExtendedAPIEnabled(profile_) && 2245 (chrome::search::IsInstantExtendedAPIEnabled(profile_) &&
dhollowa 2013/01/17 17:47:58 nit: The |IsInstantExtendedAPIEnabled| part of thi
sail 2013/01/17 18:17:12 Done.
2243 !search_model_->mode().is_ntp() && state == BookmarkBar::DETACHED)) { 2246 !search_model_->mode().is_ntp() && state == BookmarkBar::DETACHED)) {
2244 state = BookmarkBar::HIDDEN; 2247 state = BookmarkBar::HIDDEN;
2245 } 2248 }
2249 #endif
2246 2250
2247 if (state == bookmark_bar_state_) 2251 if (state == bookmark_bar_state_)
2248 return; 2252 return;
2249 2253
2250 bookmark_bar_state_ = state; 2254 bookmark_bar_state_ = state;
2251 2255
2252 if (!window_) 2256 if (!window_)
2253 return; // This is called from the constructor when window_ is NULL. 2257 return; // This is called from the constructor when window_ is NULL.
2254 2258
2255 if (reason == BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH) { 2259 if (reason == BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH) {
2256 // Don't notify BrowserWindow on a tab switch as at the time this is invoked 2260 // Don't notify BrowserWindow on a tab switch as at the time this is invoked
2257 // BrowserWindow hasn't yet switched tabs. The BrowserWindow implementations 2261 // BrowserWindow hasn't yet switched tabs. The BrowserWindow implementations
2258 // end up querying state once they process the tab switch. 2262 // end up querying state once they process the tab switch.
2259 return; 2263 return;
2260 } 2264 }
2261 2265
2266 bool shouldAnimate = reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE;
2267
2262 // Don't animate if mode is |NTP| because the bookmark is attached at top when 2268 // Don't animate if mode is |NTP| because the bookmark is attached at top when
2263 // pref is on and detached at bottom when off. 2269 // pref is on and detached at bottom when off.
2264 BookmarkBar::AnimateChangeType animate_type = 2270 // TODO(sail) Remove this once other platforms have removed the bottom
2265 ((reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE && 2271 // bookmark bar.
2266 !search_model_->mode().is_ntp()) || 2272 #if !defined(OS_MACOSX)
2267 reason == BOOKMARK_BAR_STATE_CHANGE_INSTANT_PREVIEW_STATE) ? 2273 shouldAnimate = (shouldAnimate && !search_model_->mode().is_ntp()) ||
2274 reason == BOOKMARK_BAR_STATE_CHANGE_INSTANT_PREVIEW_STATE;
kuan 2013/01/17 18:25:51 per latest discussion, we don't want to animate fo
sail 2013/01/17 18:54:55 Done.
2275 #endif
2276
2277 window_->BookmarkBarStateChanged(shouldAnimate ?
2268 BookmarkBar::ANIMATE_STATE_CHANGE : 2278 BookmarkBar::ANIMATE_STATE_CHANGE :
2269 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; 2279 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
2270 window_->BookmarkBarStateChanged(animate_type);
2271 } 2280 }
2272 2281
2273 bool Browser::ShouldHideUIForFullscreen() const { 2282 bool Browser::ShouldHideUIForFullscreen() const {
2274 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On 2283 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On
2275 // other platforms, we hide some controls when in fullscreen mode. 2284 // other platforms, we hide some controls when in fullscreen mode.
2276 #if defined(OS_MACOSX) 2285 #if defined(OS_MACOSX)
2277 return false; 2286 return false;
2278 #endif 2287 #endif
2279 return window_ && window_->IsFullscreen(); 2288 return window_ && window_->IsFullscreen();
2280 } 2289 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 if (contents && !allow_js_access) { 2362 if (contents && !allow_js_access) {
2354 contents->web_contents()->GetController().LoadURL( 2363 contents->web_contents()->GetController().LoadURL(
2355 target_url, 2364 target_url,
2356 content::Referrer(), 2365 content::Referrer(),
2357 content::PAGE_TRANSITION_LINK, 2366 content::PAGE_TRANSITION_LINK,
2358 std::string()); // No extra headers. 2367 std::string()); // No extra headers.
2359 } 2368 }
2360 2369
2361 return contents != NULL; 2370 return contents != NULL;
2362 } 2371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698