OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 #include "ui/base/win/shell.h" | 177 #include "ui/base/win/shell.h" |
178 #endif // OS_WIN | 178 #endif // OS_WIN |
179 | 179 |
180 #if defined(OS_MACOSX) | 180 #if defined(OS_MACOSX) |
181 #include "content/browser/find_pasteboard.h" | 181 #include "content/browser/find_pasteboard.h" |
182 #endif | 182 #endif |
183 | 183 |
184 #if defined(OS_CHROMEOS) | 184 #if defined(OS_CHROMEOS) |
185 #include "chrome/browser/chromeos/boot_times_loader.h" | 185 #include "chrome/browser/chromeos/boot_times_loader.h" |
186 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 186 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
187 #endif | 187 #else |
188 | |
189 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | |
190 #include "chrome/browser/download/download_shelf.h" | 188 #include "chrome/browser/download/download_shelf.h" |
191 #endif | 189 #endif |
192 | 190 |
193 #if defined(FILE_MANAGER_EXTENSION) | 191 #if defined(FILE_MANAGER_EXTENSION) |
194 #include "chrome/browser/extensions/file_manager_util.h" | 192 #include "chrome/browser/extensions/file_manager_util.h" |
195 #endif | 193 #endif |
196 | 194 |
197 using base::TimeDelta; | 195 using base::TimeDelta; |
198 | 196 |
199 /////////////////////////////////////////////////////////////////////////////// | 197 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 1430 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
1433 // other platforms, we hide some controls when in fullscreen mode. | 1431 // other platforms, we hide some controls when in fullscreen mode. |
1434 bool hide_ui_for_fullscreen = false; | 1432 bool hide_ui_for_fullscreen = false; |
1435 #if !defined(OS_MACOSX) | 1433 #if !defined(OS_MACOSX) |
1436 hide_ui_for_fullscreen = check_fullscreen && window_ && | 1434 hide_ui_for_fullscreen = check_fullscreen && window_ && |
1437 window_->IsFullscreen(); | 1435 window_->IsFullscreen(); |
1438 #endif | 1436 #endif |
1439 | 1437 |
1440 unsigned int features = FEATURE_INFOBAR | FEATURE_SIDEBAR; | 1438 unsigned int features = FEATURE_INFOBAR | FEATURE_SIDEBAR; |
1441 | 1439 |
1442 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 1440 #if !defined(OS_CHROMEOS) |
1443 // Chrome OS opens a FileBrowse pop up instead of using download shelf. | 1441 // Chrome OS opens a FileBrowse pop up instead of using download shelf. |
1444 // So FEATURE_DOWNLOADSHELF is only added for non-chromeos platforms. | 1442 // So FEATURE_DOWNLOADSHELF is only added for non-chromeos platforms. |
1445 features |= FEATURE_DOWNLOADSHELF; | 1443 features |= FEATURE_DOWNLOADSHELF; |
1446 #endif // !defined(OS_CHROMEOS) || defined(USE_AURA) | 1444 #endif // !defined(OS_CHROMEOS) |
1447 | 1445 |
1448 if (is_type_tabbed()) | 1446 if (is_type_tabbed()) |
1449 features |= FEATURE_BOOKMARKBAR; | 1447 features |= FEATURE_BOOKMARKBAR; |
1450 | 1448 |
1451 if (!hide_ui_for_fullscreen) { | 1449 if (!hide_ui_for_fullscreen) { |
1452 if (!is_type_tabbed()) | 1450 if (!is_type_tabbed()) |
1453 features |= FEATURE_TITLEBAR; | 1451 features |= FEATURE_TITLEBAR; |
1454 | 1452 |
1455 if (is_type_tabbed()) | 1453 if (is_type_tabbed()) |
1456 features |= FEATURE_TABSTRIP; | 1454 features |= FEATURE_TABSTRIP; |
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3719 // Download in a constrained popup is shown in the tab that opened it. | 3717 // Download in a constrained popup is shown in the tab that opened it. |
3720 TabContents* constrained_tab = constrained->tab_contents(); | 3718 TabContents* constrained_tab = constrained->tab_contents(); |
3721 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); | 3719 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); |
3722 return; | 3720 return; |
3723 } | 3721 } |
3724 | 3722 |
3725 if (!window()) | 3723 if (!window()) |
3726 return; | 3724 return; |
3727 | 3725 |
3728 if (DisplayOldDownloadsUI()) { | 3726 if (DisplayOldDownloadsUI()) { |
3729 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 3727 #if defined(OS_CHROMEOS) |
3730 // Don't show content browser for extension/theme downloads from gallery. | 3728 // Don't show content browser for extension/theme downloads from gallery. |
3731 ExtensionService* service = profile_->GetExtensionService(); | 3729 ExtensionService* service = profile_->GetExtensionService(); |
3732 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3730 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
3733 (service == NULL) || | 3731 (service == NULL) || |
3734 !service->IsDownloadFromGallery(download->GetURL(), | 3732 !service->IsDownloadFromGallery(download->GetURL(), |
3735 download->referrer_url())) { | 3733 download->referrer_url())) { |
3736 // Open the Active Downloads ui for chromeos. | 3734 // Open the Active Downloads ui for chromeos. |
3737 ActiveDownloadsUI::OpenPopup(profile_); | 3735 ActiveDownloadsUI::OpenPopup(profile_); |
3738 } | 3736 } |
3739 #else | 3737 #elif !defined(USE_AURA) |
3740 // GetDownloadShelf creates the download shelf if it was not yet created. | 3738 // GetDownloadShelf creates the download shelf if it was not yet created. |
3741 DownloadShelf* shelf = window()->GetDownloadShelf(); | 3739 DownloadShelf* shelf = window()->GetDownloadShelf(); |
3742 shelf->AddDownload(new DownloadItemModel(download)); | 3740 shelf->AddDownload(new DownloadItemModel(download)); |
3743 // Don't show the animation for "Save file" downloads. | 3741 // Don't show the animation for "Save file" downloads. |
3744 // For non-theme extensions, we don't show the download animation. | 3742 // For non-theme extensions, we don't show the download animation. |
3745 // Show animation in same window as the download shelf. Download shelf | 3743 // Show animation in same window as the download shelf. Download shelf |
3746 // may not be in the same window that initiated the download, e.g. | 3744 // may not be in the same window that initiated the download, e.g. |
3747 // Panels. | 3745 // Panels. |
3748 // Don't show the animation if the selected tab is not visible (i.e. the | 3746 // Don't show the animation if the selected tab is not visible (i.e. the |
3749 // window is minimized, we're in a unit test, etc.). | 3747 // window is minimized, we're in a unit test, etc.). |
3750 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | 3748 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
3751 if ((download->total_bytes() > 0) && | 3749 if ((download->total_bytes() > 0) && |
3752 !ChromeDownloadManagerDelegate::IsExtensionDownload(download) && | 3750 !ChromeDownloadManagerDelegate::IsExtensionDownload(download) && |
3753 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 3751 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
3754 ui::Animation::ShouldRenderRichAnimation()) { | 3752 ui::Animation::ShouldRenderRichAnimation()) { |
3755 DownloadStartedAnimation::Show(shelf_tab); | 3753 DownloadStartedAnimation::Show(shelf_tab); |
3756 } | 3754 } |
3757 #else | |
3758 // TODO(jamescook): Downloads UI for non-ChromeOS Aura, crbug.com/103488 | |
3759 NOTIMPLEMENTED(); | |
3760 #endif | 3755 #endif |
3761 } | 3756 } |
3762 | 3757 |
3763 // If the download occurs in a new tab, close it. | 3758 // If the download occurs in a new tab, close it. |
3764 if (source->controller().IsInitialNavigation() && tab_count() > 1) | 3759 if (source->controller().IsInitialNavigation() && tab_count() > 1) |
3765 CloseContents(source); | 3760 CloseContents(source); |
3766 } | 3761 } |
3767 | 3762 |
3768 void Browser::ShowPageInfo(content::BrowserContext* browser_context, | 3763 void Browser::ShowPageInfo(content::BrowserContext* browser_context, |
3769 const GURL& url, | 3764 const GURL& url, |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5527 } | 5522 } |
5528 | 5523 |
5529 void Browser::UpdateFullscreenExitBubbleContent() { | 5524 void Browser::UpdateFullscreenExitBubbleContent() { |
5530 GURL url; | 5525 GURL url; |
5531 if (fullscreened_tab_) | 5526 if (fullscreened_tab_) |
5532 url = fullscreened_tab_->tab_contents()->GetURL(); | 5527 url = fullscreened_tab_->tab_contents()->GetURL(); |
5533 | 5528 |
5534 window_->UpdateFullscreenExitBubbleContent( | 5529 window_->UpdateFullscreenExitBubbleContent( |
5535 url, GetFullscreenExitBubbleType()); | 5530 url, GetFullscreenExitBubbleType()); |
5536 } | 5531 } |
OLD | NEW |