| 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 void Browser::RenderWidgetShowing() { | 1487 void Browser::RenderWidgetShowing() { |
| 1488 window_->DisableInactiveFrame(); | 1488 window_->DisableInactiveFrame(); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 int Browser::GetExtraRenderViewHeight() const { | 1491 int Browser::GetExtraRenderViewHeight() const { |
| 1492 return window_->GetExtraRenderViewHeight(); | 1492 return window_->GetExtraRenderViewHeight(); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 void Browser::OnStartDownload(WebContents* source, | 1495 void Browser::OnStartDownload(WebContents* source, |
| 1496 content::DownloadItem* download) { | 1496 content::DownloadItem* download) { |
| 1497 scoped_ptr<DownloadItemModel> download_model(new DownloadItemModel(download)); | 1497 if (!DownloadItemModel(download).ShouldShowInShelf()) |
| 1498 if (!download_model->ShouldShowInShelf()) | |
| 1499 return; | 1498 return; |
| 1500 | 1499 |
| 1501 WebContents* constrained = GetConstrainingWebContents(source); | 1500 WebContents* constrained = GetConstrainingWebContents(source); |
| 1502 if (constrained != source) { | 1501 if (constrained != source) { |
| 1503 // Download in a constrained popup is shown in the tab that opened it. | 1502 // Download in a constrained popup is shown in the tab that opened it. |
| 1504 constrained->GetDelegate()->OnStartDownload(constrained, download); | 1503 constrained->GetDelegate()->OnStartDownload(constrained, download); |
| 1505 return; | 1504 return; |
| 1506 } | 1505 } |
| 1507 | 1506 |
| 1508 if (!window()) | 1507 if (!window()) |
| 1509 return; | 1508 return; |
| 1510 | 1509 |
| 1511 // GetDownloadShelf creates the download shelf if it was not yet created. | 1510 // GetDownloadShelf creates the download shelf if it was not yet created. |
| 1512 DownloadShelf* shelf = window()->GetDownloadShelf(); | 1511 DownloadShelf* shelf = window()->GetDownloadShelf(); |
| 1513 shelf->AddDownload(download_model.release()); | 1512 shelf->AddDownload(download); |
| 1514 // Don't show the animation for "Save file" downloads. | 1513 // Don't show the animation for "Save file" downloads. |
| 1515 // For non-theme extensions, we don't show the download animation. | 1514 // For non-theme extensions, we don't show the download animation. |
| 1516 // Show animation in same window as the download shelf. Download shelf | 1515 // Show animation in same window as the download shelf. Download shelf |
| 1517 // may not be in the same window that initiated the download. | 1516 // may not be in the same window that initiated the download. |
| 1518 // Don't show the animation if the selected tab is not visible (i.e. the | 1517 // Don't show the animation if the selected tab is not visible (i.e. the |
| 1519 // window is minimized, we're in a unit test, etc.). | 1518 // window is minimized, we're in a unit test, etc.). |
| 1520 WebContents* shelf_tab = chrome::GetActiveWebContents(shelf->browser()); | 1519 WebContents* shelf_tab = chrome::GetActiveWebContents(shelf->browser()); |
| 1521 if ((download->GetTotalBytes() > 0) && | 1520 if ((download->GetTotalBytes() > 0) && |
| 1522 !download_crx_util::IsExtensionDownload(*download) && | 1521 !download_crx_util::IsExtensionDownload(*download) && |
| 1523 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 1522 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 if (contents && !allow_js_access) { | 2437 if (contents && !allow_js_access) { |
| 2439 contents->web_contents()->GetController().LoadURL( | 2438 contents->web_contents()->GetController().LoadURL( |
| 2440 target_url, | 2439 target_url, |
| 2441 content::Referrer(), | 2440 content::Referrer(), |
| 2442 content::PAGE_TRANSITION_LINK, | 2441 content::PAGE_TRANSITION_LINK, |
| 2443 std::string()); // No extra headers. | 2442 std::string()); // No extra headers. |
| 2444 } | 2443 } |
| 2445 | 2444 |
| 2446 return contents != NULL; | 2445 return contents != NULL; |
| 2447 } | 2446 } |
| OLD | NEW |