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

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

Issue 7605003: --downloads-new-ui completely disables the download shelf. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " Created 9 years, 4 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
OLDNEW
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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 if (constrained != wrapper) { 3372 if (constrained != wrapper) {
3373 // Download in a constrained popup is shown in the tab that opened it. 3373 // Download in a constrained popup is shown in the tab that opened it.
3374 TabContents* constrained_tab = constrained->tab_contents(); 3374 TabContents* constrained_tab = constrained->tab_contents();
3375 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); 3375 constrained_tab->delegate()->OnStartDownload(constrained_tab, download);
3376 return; 3376 return;
3377 } 3377 }
3378 3378
3379 if (!window()) 3379 if (!window())
3380 return; 3380 return;
3381 3381
3382 if (!CommandLine::ForCurrentProcess()->HasSwitch(
cbentzel 2011/08/11 20:08:29 I'd rather wrap this in a helper function such as
benjhayden 2011/08/15 14:57:15 Done.
3383 switches::kDownloadsNewUI)) {
3382 #if defined(OS_CHROMEOS) 3384 #if defined(OS_CHROMEOS)
3383 // Don't show content browser for extension/theme downloads from gallery. 3385 // Don't show content browser for extension/theme downloads from gallery.
3384 if (download->is_extension_install()) {
3385 ExtensionService* service = profile_->GetExtensionService(); 3386 ExtensionService* service = profile_->GetExtensionService();
3386 if (service && service->IsDownloadFromGallery(download->GetURL(), 3387 if (!download->is_extension_install() ||
3387 download->referrer_url())) { 3388 (service == NULL) ||
3388 return; 3389 !service->IsDownloadFromGallery(download->GetURL(),
3390 download->referrer_url())) {
3391 // Open the Active Downloads ui for chromeos.
3392 ActiveDownloadsUI::OpenPopup(profile_);
3389 } 3393 }
3394 #else
3395 // GetDownloadShelf creates the download shelf if it was not yet created.
3396 DownloadShelf* shelf = window()->GetDownloadShelf();
3397 shelf->AddDownload(new DownloadItemModel(download));
3398
3399 // Don't show the animation for "Save file" downloads.
3400 if (download->total_bytes() > 0) {
3401 // For non-theme extensions, we don't show the download animation.
3402 if (!download->is_extension_install() ||
3403 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) {
3404 // Show animation in same window as the download shelf. Download shelf
3405 // may not be in the same window that initiated the download, e.g.
3406 // Panels.
3407 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents();
3408
3409 // We make this check for the case of minimized windows, unit tests,
3410 // etc.
3411 if (platform_util::IsVisible(shelf_tab->GetNativeView()) &&
3412 ui::Animation::ShouldRenderRichAnimation()) {
3413 DownloadStartedAnimation::Show(shelf_tab);
3414 }
3415 }
3416 }
3417 #endif
3390 } 3418 }
3391 // Open the Active Downloads ui for chromeos.
3392 ActiveDownloadsUI::OpenPopup(profile_);
3393 #else
3394 // GetDownloadShelf creates the download shelf if it was not yet created.
3395 DownloadShelf* shelf = window()->GetDownloadShelf();
3396 shelf->AddDownload(new DownloadItemModel(download));
3397
3398 // Don't show the animation for "Save file" downloads.
3399 if (download->total_bytes() <= 0)
3400 return;
3401
3402 // For non-theme extensions, we don't show the download animation.
3403 if (download->is_extension_install() &&
3404 !ExtensionService::IsDownloadFromMiniGallery(download->GetURL()))
3405 return;
3406
3407 // Show animation in same window as the download shelf. Download shelf
3408 // may not be in the same window that initiated the download, e.g. Panels.
3409 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents();
3410
3411 // We make this check for the case of minimized windows, unit tests, etc.
3412 if (platform_util::IsVisible(shelf_tab->GetNativeView()) &&
3413 ui::Animation::ShouldRenderRichAnimation()) {
3414 DownloadStartedAnimation::Show(shelf_tab);
3415 }
3416 #endif
3417 3419
3418 // If the download occurs in a new tab, close it. 3420 // If the download occurs in a new tab, close it.
3419 if (source->controller().IsInitialNavigation() && tab_count() > 1) 3421 if (source->controller().IsInitialNavigation() && tab_count() > 1)
3420 CloseContents(source); 3422 CloseContents(source);
3421 } 3423 }
3422 3424
3423 void Browser::ShowPageInfo(content::BrowserContext* browser_context, 3425 void Browser::ShowPageInfo(content::BrowserContext* browser_context,
3424 const GURL& url, 3426 const GURL& url,
3425 const NavigationEntry::SSLStatus& ssl, 3427 const NavigationEntry::SSLStatus& ssl,
3426 bool show_history) { 3428 bool show_history) {
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
4840 } 4842 }
4841 4843
4842 void Browser::ShowSyncSetup() { 4844 void Browser::ShowSyncSetup() {
4843 ProfileSyncService* service = 4845 ProfileSyncService* service =
4844 profile()->GetOriginalProfile()->GetProfileSyncService(); 4846 profile()->GetOriginalProfile()->GetProfileSyncService();
4845 if (service->HasSyncSetupCompleted()) 4847 if (service->HasSyncSetupCompleted())
4846 ShowOptionsTab(chrome::kSyncSetupSubPage); 4848 ShowOptionsTab(chrome::kSyncSetupSubPage);
4847 else 4849 else
4848 service->ShowLoginDialog(); 4850 service->ShowLoginDialog();
4849 } 4851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698