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

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

Issue 10938033: Switch BlockedContentTabHelper 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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 void Browser::RenderWidgetShowing() { 1414 void Browser::RenderWidgetShowing() {
1415 window_->DisableInactiveFrame(); 1415 window_->DisableInactiveFrame();
1416 } 1416 }
1417 1417
1418 int Browser::GetExtraRenderViewHeight() const { 1418 int Browser::GetExtraRenderViewHeight() const {
1419 return window_->GetExtraRenderViewHeight(); 1419 return window_->GetExtraRenderViewHeight();
1420 } 1420 }
1421 1421
1422 void Browser::OnStartDownload(WebContents* source, 1422 void Browser::OnStartDownload(WebContents* source,
1423 content::DownloadItem* download) { 1423 content::DownloadItem* download) {
1424 TabContents* tab_contents = TabContents::FromWebContents(source); 1424 WebContents* constrained = GetConstrainingWebContents(source);
1425 TabContents* constrained = GetConstrainingTabContents(tab_contents); 1425 if (constrained != source) {
1426 if (constrained != tab_contents) {
1427 // Download in a constrained popup is shown in the tab that opened it. 1426 // Download in a constrained popup is shown in the tab that opened it.
1428 WebContents* constrained_tab = constrained->web_contents(); 1427 constrained->GetDelegate()->OnStartDownload(constrained, download);
1429 constrained_tab->GetDelegate()->OnStartDownload(constrained_tab, download);
1430 return; 1428 return;
1431 } 1429 }
1432 1430
1433 if (!window()) 1431 if (!window())
1434 return; 1432 return;
1435 1433
1436 // GetDownloadShelf creates the download shelf if it was not yet created. 1434 // GetDownloadShelf creates the download shelf if it was not yet created.
1437 DownloadShelf* shelf = window()->GetDownloadShelf(); 1435 DownloadShelf* shelf = window()->GetDownloadShelf();
1438 shelf->AddDownload(new DownloadItemModel(download)); 1436 shelf->AddDownload(new DownloadItemModel(download));
1439 // Don't show the animation for "Save file" downloads. 1437 // Don't show the animation for "Save file" downloads.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 } 1735 }
1738 tab_strip_model_->SetTabBlocked(index, blocked); 1736 tab_strip_model_->SetTabBlocked(index, blocked);
1739 command_controller_->PrintingStateChanged(); 1737 command_controller_->PrintingStateChanged();
1740 if (!blocked && chrome::GetActiveTabContents(this) == tab_contents) 1738 if (!blocked && chrome::GetActiveTabContents(this) == tab_contents)
1741 tab_contents->web_contents()->Focus(); 1739 tab_contents->web_contents()->Focus();
1742 } 1740 }
1743 1741
1744 /////////////////////////////////////////////////////////////////////////////// 1742 ///////////////////////////////////////////////////////////////////////////////
1745 // Browser, BlockedContentTabHelperDelegate implementation: 1743 // Browser, BlockedContentTabHelperDelegate implementation:
1746 1744
1747 TabContents* Browser::GetConstrainingTabContents(TabContents* source) { 1745 content::WebContents* Browser::GetConstrainingWebContents(
1746 content::WebContents* source) {
1748 return source; 1747 return source;
1749 } 1748 }
1750 1749
1751 /////////////////////////////////////////////////////////////////////////////// 1750 ///////////////////////////////////////////////////////////////////////////////
1752 // Browser, BookmarkTabHelperDelegate implementation: 1751 // Browser, BookmarkTabHelperDelegate implementation:
1753 1752
1754 void Browser::URLStarredChanged(content::WebContents* web_contents, 1753 void Browser::URLStarredChanged(content::WebContents* web_contents,
1755 bool starred) { 1754 bool starred) {
1756 if (web_contents == chrome::GetActiveWebContents(this)) 1755 if (web_contents == chrome::GetActiveWebContents(this))
1757 window_->SetStarredState(starred); 1756 window_->SetStarredState(starred);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 if (contents && !allow_js_access) { 2286 if (contents && !allow_js_access) {
2288 contents->web_contents()->GetController().LoadURL( 2287 contents->web_contents()->GetController().LoadURL(
2289 target_url, 2288 target_url,
2290 content::Referrer(), 2289 content::Referrer(),
2291 content::PAGE_TRANSITION_LINK, 2290 content::PAGE_TRANSITION_LINK,
2292 std::string()); // No extra headers. 2291 std::string()); // No extra headers.
2293 } 2292 }
2294 2293
2295 return contents != NULL; 2294 return contents != NULL;
2296 } 2295 }
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