OLD | NEW |
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 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 } else { | 2221 } else { |
2222 WebContents* web_contents = tab_strip_model_->GetActiveWebContents(); | 2222 WebContents* web_contents = tab_strip_model_->GetActiveWebContents(); |
2223 BookmarkTabHelper* bookmark_tab_helper = | 2223 BookmarkTabHelper* bookmark_tab_helper = |
2224 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL; | 2224 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL; |
2225 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar()) | 2225 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar()) |
2226 state = BookmarkBar::DETACHED; | 2226 state = BookmarkBar::DETACHED; |
2227 else | 2227 else |
2228 state = BookmarkBar::HIDDEN; | 2228 state = BookmarkBar::HIDDEN; |
2229 } | 2229 } |
2230 | 2230 |
2231 // Don't allow the bookmark bar to be shown in suggestions mode or | 2231 // Don't allow the bookmark bar to be shown in suggestions mode. |
2232 // for instant extended api, non-NTP modes when it's detached. | 2232 if (search_model_->mode().is_search_suggestions()) |
2233 if (search_model_->mode().is_search_suggestions() || | |
2234 (chrome::search::IsInstantExtendedAPIEnabled(profile_) && | |
2235 !search_model_->mode().is_ntp() && state == BookmarkBar::DETACHED)) { | |
2236 state = BookmarkBar::HIDDEN; | 2233 state = BookmarkBar::HIDDEN; |
2237 } | |
2238 | 2234 |
2239 if (state == bookmark_bar_state_) | 2235 if (state == bookmark_bar_state_) |
2240 return; | 2236 return; |
2241 | 2237 |
2242 bookmark_bar_state_ = state; | 2238 bookmark_bar_state_ = state; |
2243 | 2239 |
2244 if (!window_) | 2240 if (!window_) |
2245 return; // This is called from the constructor when window_ is NULL. | 2241 return; // This is called from the constructor when window_ is NULL. |
2246 | 2242 |
2247 if (reason == BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH) { | 2243 if (reason == BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH) { |
2248 // Don't notify BrowserWindow on a tab switch as at the time this is invoked | 2244 // Don't notify BrowserWindow on a tab switch as at the time this is invoked |
2249 // BrowserWindow hasn't yet switched tabs. The BrowserWindow implementations | 2245 // BrowserWindow hasn't yet switched tabs. The BrowserWindow implementations |
2250 // end up querying state once they process the tab switch. | 2246 // end up querying state once they process the tab switch. |
2251 return; | 2247 return; |
2252 } | 2248 } |
2253 | 2249 |
2254 // Don't animate if mode is |NTP| because the bookmark is attached at top when | 2250 // Don't animate if mode is |NTP| because the bookmark is attached at top when |
2255 // pref is on and detached at bottom when off. | 2251 // pref is on and detached at bottom when off. |
2256 BookmarkBar::AnimateChangeType animate_type = | 2252 BookmarkBar::AnimateChangeType animate_type = |
2257 ((reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE && | 2253 (reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE || |
2258 !search_model_->mode().is_ntp()) || | |
2259 reason == BOOKMARK_BAR_STATE_CHANGE_INSTANT_PREVIEW_STATE) ? | 2254 reason == BOOKMARK_BAR_STATE_CHANGE_INSTANT_PREVIEW_STATE) ? |
2260 BookmarkBar::ANIMATE_STATE_CHANGE : | 2255 BookmarkBar::ANIMATE_STATE_CHANGE : |
2261 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; | 2256 BookmarkBar::DONT_ANIMATE_STATE_CHANGE; |
2262 window_->BookmarkBarStateChanged(animate_type); | 2257 window_->BookmarkBarStateChanged(animate_type); |
2263 } | 2258 } |
2264 | 2259 |
2265 bool Browser::ShouldHideUIForFullscreen() const { | 2260 bool Browser::ShouldHideUIForFullscreen() const { |
2266 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 2261 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
2267 // other platforms, we hide some controls when in fullscreen mode. | 2262 // other platforms, we hide some controls when in fullscreen mode. |
2268 #if defined(OS_MACOSX) | 2263 #if defined(OS_MACOSX) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 if (contents && !allow_js_access) { | 2340 if (contents && !allow_js_access) { |
2346 contents->web_contents()->GetController().LoadURL( | 2341 contents->web_contents()->GetController().LoadURL( |
2347 target_url, | 2342 target_url, |
2348 content::Referrer(), | 2343 content::Referrer(), |
2349 content::PAGE_TRANSITION_LINK, | 2344 content::PAGE_TRANSITION_LINK, |
2350 std::string()); // No extra headers. | 2345 std::string()); // No extra headers. |
2351 } | 2346 } |
2352 | 2347 |
2353 return contents != NULL; | 2348 return contents != NULL; |
2354 } | 2349 } |
OLD | NEW |