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

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

Issue 10945010: Switch BookmarkTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_adoption.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 /////////////////////////////////////////////////////////////////////////////// 1742 ///////////////////////////////////////////////////////////////////////////////
1743 // Browser, BlockedContentTabHelperDelegate implementation: 1743 // Browser, BlockedContentTabHelperDelegate implementation:
1744 1744
1745 TabContents* Browser::GetConstrainingTabContents(TabContents* source) { 1745 TabContents* Browser::GetConstrainingTabContents(TabContents* source) {
1746 return source; 1746 return source;
1747 } 1747 }
1748 1748
1749 /////////////////////////////////////////////////////////////////////////////// 1749 ///////////////////////////////////////////////////////////////////////////////
1750 // Browser, BookmarkTabHelperDelegate implementation: 1750 // Browser, BookmarkTabHelperDelegate implementation:
1751 1751
1752 void Browser::URLStarredChanged(TabContents* source, bool starred) { 1752 void Browser::URLStarredChanged(content::WebContents* web_contents,
1753 if (source == chrome::GetActiveTabContents(this)) 1753 bool starred) {
1754 if (web_contents == chrome::GetActiveWebContents(this))
1754 window_->SetStarredState(starred); 1755 window_->SetStarredState(starred);
1755 } 1756 }
1756 1757
1757 /////////////////////////////////////////////////////////////////////////////// 1758 ///////////////////////////////////////////////////////////////////////////////
1758 // Browser, ZoomObserver implementation: 1759 // Browser, ZoomObserver implementation:
1759 1760
1760 void Browser::OnZoomChanged(TabContents* source, bool can_show_bubble) { 1761 void Browser::OnZoomChanged(TabContents* source, bool can_show_bubble) {
1761 if (source == chrome::GetActiveTabContents(this)) { 1762 if (source == chrome::GetActiveTabContents(this)) {
1762 // Only show the zoom bubble for zoom changes in the active window. 1763 // Only show the zoom bubble for zoom changes in the active window.
1763 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive()); 1764 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive());
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 } 2169 }
2169 2170
2170 void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) { 2171 void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) {
2171 BookmarkBar::State state; 2172 BookmarkBar::State state;
2172 // The bookmark bar is hidden in fullscreen mode, unless on the new tab page. 2173 // The bookmark bar is hidden in fullscreen mode, unless on the new tab page.
2173 if (browser_defaults::bookmarks_enabled && 2174 if (browser_defaults::bookmarks_enabled &&
2174 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) && 2175 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) &&
2175 (!window_ || !window_->IsFullscreen())) { 2176 (!window_ || !window_->IsFullscreen())) {
2176 state = BookmarkBar::SHOW; 2177 state = BookmarkBar::SHOW;
2177 } else { 2178 } else {
2178 TabContents* tab = chrome::GetActiveTabContents(this); 2179 WebContents* web_contents = chrome::GetActiveWebContents(this);
2179 if (tab && tab->bookmark_tab_helper()->ShouldShowBookmarkBar()) 2180 BookmarkTabHelper* bookmark_tab_helper =
2181 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL;
2182 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar())
2180 state = BookmarkBar::DETACHED; 2183 state = BookmarkBar::DETACHED;
2181 else 2184 else
2182 state = BookmarkBar::HIDDEN; 2185 state = BookmarkBar::HIDDEN;
2183 } 2186 }
2184 2187
2185 // Only allow the bookmark bar to be shown in default mode. 2188 // Only allow the bookmark bar to be shown in default mode.
2186 if (!search_model_->mode().is_default()) 2189 if (!search_model_->mode().is_default())
2187 state = BookmarkBar::HIDDEN; 2190 state = BookmarkBar::HIDDEN;
2188 2191
2189 if (state == bookmark_bar_state_) 2192 if (state == bookmark_bar_state_)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 if (contents && !allow_js_access) { 2284 if (contents && !allow_js_access) {
2282 contents->web_contents()->GetController().LoadURL( 2285 contents->web_contents()->GetController().LoadURL(
2283 target_url, 2286 target_url,
2284 content::Referrer(), 2287 content::Referrer(),
2285 content::PAGE_TRANSITION_LINK, 2288 content::PAGE_TRANSITION_LINK,
2286 std::string()); // No extra headers. 2289 std::string()); // No extra headers.
2287 } 2290 }
2288 2291
2289 return contents != NULL; 2292 return contents != NULL;
2290 } 2293 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_adoption.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698