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

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

Issue 6905049: Detect removed files and reflect the state in chrome://downloads and the download shelf (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Correct typo Created 9 years, 7 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 <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 // will put it out of sync with the actual state like whether we're 2446 // will put it out of sync with the actual state like whether we're
2447 // displaying a favicon, which controls the throbber. If we updated it here, 2447 // displaying a favicon, which controls the throbber. If we updated it here,
2448 // the throbber will show the default favicon for a split second when 2448 // the throbber will show the default favicon for a split second when
2449 // navigating away from the new tab page. 2449 // navigating away from the new tab page.
2450 ScheduleUIUpdate(contents->tab_contents(), TabContents::INVALIDATE_URL); 2450 ScheduleUIUpdate(contents->tab_contents(), TabContents::INVALIDATE_URL);
2451 2451
2452 if (contents_is_selected) 2452 if (contents_is_selected)
2453 contents->tab_contents()->Focus(); 2453 contents->tab_contents()->Focus();
2454 } 2454 }
2455 2455
2456 void Browser::CheckForFilesRemoval() {
2457 if (profile_->HasCreatedDownloadManager()) {
2458 DownloadManager* download_manager = profile_->GetDownloadManager();
2459 download_manager->CheckForFilesRemoval();
2460 }
2461 }
2462
2456 GURL Browser::GetHomePage() const { 2463 GURL Browser::GetHomePage() const {
2457 // --homepage overrides any preferences. 2464 // --homepage overrides any preferences.
2458 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 2465 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
2459 if (command_line.HasSwitch(switches::kHomePage)) { 2466 if (command_line.HasSwitch(switches::kHomePage)) {
2460 // TODO(evanm): clean up usage of DIR_CURRENT. 2467 // TODO(evanm): clean up usage of DIR_CURRENT.
2461 // http://code.google.com/p/chromium/issues/detail?id=60630 2468 // http://code.google.com/p/chromium/issues/detail?id=60630
2462 // For now, allow this code to call getcwd(). 2469 // For now, allow this code to call getcwd().
2463 base::ThreadRestrictions::ScopedAllowIO allow_io; 2470 base::ThreadRestrictions::ScopedAllowIO allow_io;
2464 2471
2465 FilePath browser_directory; 2472 FilePath browser_directory;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 } 3220 }
3214 3221
3215 int Browser::GetExtraRenderViewHeight() const { 3222 int Browser::GetExtraRenderViewHeight() const {
3216 return window_->GetExtraRenderViewHeight(); 3223 return window_->GetExtraRenderViewHeight();
3217 } 3224 }
3218 3225
3219 void Browser::OnStartDownload(DownloadItem* download, TabContents* tab) { 3226 void Browser::OnStartDownload(DownloadItem* download, TabContents* tab) {
3220 if (!window()) 3227 if (!window())
3221 return; 3228 return;
3222 3229
3230 CheckForFilesRemoval();
Randy Smith (Not in Mondays) 2011/05/13 20:45:32 I apologize--I know I recommended this location, b
haraken1 2011/05/16 11:42:27 I agree that we should not include too frequent pr
Randy Smith (Not in Mondays) 2011/05/16 20:57:12 So I think the use case you describe (a "reload" o
3231
3223 #if defined(OS_CHROMEOS) 3232 #if defined(OS_CHROMEOS)
3224 // Don't show content browser for extension/theme downloads from gallery. 3233 // Don't show content browser for extension/theme downloads from gallery.
3225 if (download->is_extension_install()) { 3234 if (download->is_extension_install()) {
3226 ExtensionService* service = profile_->GetExtensionService(); 3235 ExtensionService* service = profile_->GetExtensionService();
3227 if (service && service->IsDownloadFromGallery(download->url(), 3236 if (service && service->IsDownloadFromGallery(download->url(),
3228 download->referrer_url())) { 3237 download->referrer_url())) {
3229 return; 3238 return;
3230 } 3239 }
3231 } 3240 }
3232 // Open the Active Downloads ui for chromeos. 3241 // Open the Active Downloads ui for chromeos.
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
4511 TabContents* current_tab = GetSelectedTabContents(); 4520 TabContents* current_tab = GetSelectedTabContents();
4512 if (current_tab) { 4521 if (current_tab) {
4513 content_restrictions = current_tab->content_restrictions(); 4522 content_restrictions = current_tab->content_restrictions();
4514 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); 4523 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry();
4515 // See comment in UpdateCommandsForTabState about why we call url(). 4524 // See comment in UpdateCommandsForTabState about why we call url().
4516 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) 4525 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()))
4517 content_restrictions |= CONTENT_RESTRICTION_SAVE; 4526 content_restrictions |= CONTENT_RESTRICTION_SAVE;
4518 } 4527 }
4519 return content_restrictions; 4528 return content_restrictions;
4520 } 4529 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698