| OLD | NEW |
| 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 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 user_gesture); | 3193 user_gesture); |
| 3194 return; | 3194 return; |
| 3195 } | 3195 } |
| 3196 | 3196 |
| 3197 // Handle blocking of popups. | 3197 // Handle blocking of popups. |
| 3198 if ((disposition == NEW_POPUP) && !user_gesture && | 3198 if ((disposition == NEW_POPUP) && !user_gesture && |
| 3199 !CommandLine::ForCurrentProcess()->HasSwitch( | 3199 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 3200 switches::kDisablePopupBlocking)) { | 3200 switches::kDisablePopupBlocking)) { |
| 3201 // Unrequested popups from normal pages are constrained unless they're in | 3201 // Unrequested popups from normal pages are constrained unless they're in |
| 3202 // the whitelist. The popup owner will handle checking this. | 3202 // the whitelist. The popup owner will handle checking this. |
| 3203 GetConstrainingContentsWrapper(source_tab_contents)-> | 3203 GetConstrainingTabContents(source_tab_contents)-> |
| 3204 blocked_content_tab_helper()-> | 3204 blocked_content_tab_helper()-> |
| 3205 AddPopup(new_tab_contents, initial_pos, user_gesture); | 3205 AddPopup(new_tab_contents, initial_pos, user_gesture); |
| 3206 return; | 3206 return; |
| 3207 } | 3207 } |
| 3208 | 3208 |
| 3209 new_contents->GetRenderViewHost()->DisassociateFromPopupCount(); | 3209 new_contents->GetRenderViewHost()->DisassociateFromPopupCount(); |
| 3210 } | 3210 } |
| 3211 | 3211 |
| 3212 browser::NavigateParams params(this, new_tab_contents); | 3212 browser::NavigateParams params(this, new_tab_contents); |
| 3213 params.source_contents = source ? | 3213 params.source_contents = source ? |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 } | 3413 } |
| 3414 | 3414 |
| 3415 int Browser::GetExtraRenderViewHeight() const { | 3415 int Browser::GetExtraRenderViewHeight() const { |
| 3416 return window_->GetExtraRenderViewHeight(); | 3416 return window_->GetExtraRenderViewHeight(); |
| 3417 } | 3417 } |
| 3418 | 3418 |
| 3419 void Browser::OnStartDownload(WebContents* source, | 3419 void Browser::OnStartDownload(WebContents* source, |
| 3420 content::DownloadItem* download) { | 3420 content::DownloadItem* download) { |
| 3421 TabContents* tab_contents = | 3421 TabContents* tab_contents = |
| 3422 TabContents::GetOwningTabContentsForWebContents(source); | 3422 TabContents::GetOwningTabContentsForWebContents(source); |
| 3423 TabContents* constrained = GetConstrainingContentsWrapper(tab_contents); | 3423 TabContents* constrained = GetConstrainingTabContents(tab_contents); |
| 3424 if (constrained != tab_contents) { | 3424 if (constrained != tab_contents) { |
| 3425 // Download in a constrained popup is shown in the tab that opened it. | 3425 // Download in a constrained popup is shown in the tab that opened it. |
| 3426 WebContents* constrained_tab = constrained->web_contents(); | 3426 WebContents* constrained_tab = constrained->web_contents(); |
| 3427 constrained_tab->GetDelegate()->OnStartDownload(constrained_tab, download); | 3427 constrained_tab->GetDelegate()->OnStartDownload(constrained_tab, download); |
| 3428 return; | 3428 return; |
| 3429 } | 3429 } |
| 3430 | 3430 |
| 3431 if (!window()) | 3431 if (!window()) |
| 3432 return; | 3432 return; |
| 3433 | 3433 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3714 } | 3714 } |
| 3715 tab_strip_model_->SetTabBlocked(index, blocked); | 3715 tab_strip_model_->SetTabBlocked(index, blocked); |
| 3716 UpdatePrintingState(tab_contents->web_contents()->GetContentRestrictions()); | 3716 UpdatePrintingState(tab_contents->web_contents()->GetContentRestrictions()); |
| 3717 if (!blocked && GetActiveTabContents() == tab_contents) | 3717 if (!blocked && GetActiveTabContents() == tab_contents) |
| 3718 tab_contents->web_contents()->Focus(); | 3718 tab_contents->web_contents()->Focus(); |
| 3719 } | 3719 } |
| 3720 | 3720 |
| 3721 /////////////////////////////////////////////////////////////////////////////// | 3721 /////////////////////////////////////////////////////////////////////////////// |
| 3722 // Browser, BlockedContentTabHelperDelegate implementation: | 3722 // Browser, BlockedContentTabHelperDelegate implementation: |
| 3723 | 3723 |
| 3724 TabContents* Browser::GetConstrainingContentsWrapper(TabContents* source) { | 3724 TabContents* Browser::GetConstrainingTabContents(TabContents* source) { |
| 3725 return source; | 3725 return source; |
| 3726 } | 3726 } |
| 3727 | 3727 |
| 3728 /////////////////////////////////////////////////////////////////////////////// | 3728 /////////////////////////////////////////////////////////////////////////////// |
| 3729 // Browser, BookmarkTabHelperDelegate implementation: | 3729 // Browser, BookmarkTabHelperDelegate implementation: |
| 3730 | 3730 |
| 3731 void Browser::URLStarredChanged(TabContents* source, bool starred) { | 3731 void Browser::URLStarredChanged(TabContents* source, bool starred) { |
| 3732 if (source == GetActiveTabContents()) | 3732 if (source == GetActiveTabContents()) |
| 3733 window_->SetStarredState(starred); | 3733 window_->SetStarredState(starred); |
| 3734 } | 3734 } |
| (...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5172 if (contents && !allow_js_access) { | 5172 if (contents && !allow_js_access) { |
| 5173 contents->web_contents()->GetController().LoadURL( | 5173 contents->web_contents()->GetController().LoadURL( |
| 5174 target_url, | 5174 target_url, |
| 5175 content::Referrer(), | 5175 content::Referrer(), |
| 5176 content::PAGE_TRANSITION_LINK, | 5176 content::PAGE_TRANSITION_LINK, |
| 5177 std::string()); // No extra headers. | 5177 std::string()); // No extra headers. |
| 5178 } | 5178 } |
| 5179 | 5179 |
| 5180 return contents != NULL; | 5180 return contents != NULL; |
| 5181 } | 5181 } |
| OLD | NEW |