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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 9316004: Move common file path related methods between chrome & content to file_util. I reduced the 4 meth... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove includes Created 8 years, 10 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) 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 15 matching lines...) Expand all
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
28 #include "chrome/browser/download/download_extensions.h" 28 #include "chrome/browser/download/download_extensions.h"
29 #include "chrome/browser/download/download_item_model.h" 29 #include "chrome/browser/download/download_item_model.h"
30 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
32 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/time_format.h" 34 #include "chrome/common/time_format.h"
35 #include "content/browser/download/download_create_info.h" 35 #include "content/browser/download/download_create_info.h"
36 #include "content/browser/download/download_file.h"
37 #include "content/browser/download/download_types.h" 36 #include "content/browser/download/download_types.h"
38 #include "content/browser/renderer_host/render_view_host.h" 37 #include "content/browser/renderer_host/render_view_host.h"
39 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/download_item.h" 39 #include "content/public/browser/download_item.h"
41 #include "content/public/browser/download_manager.h" 40 #include "content/public/browser/download_manager.h"
42 #include "content/public/common/url_constants.h" 41 #include "content/public/common/url_constants.h"
43 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
44 #include "grit/locale_settings.h" 43 #include "grit/locale_settings.h"
45 #include "grit/theme_resources.h" 44 #include "grit/theme_resources.h"
46 #include "net/base/mime_util.h" 45 #include "net/base/mime_util.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 taskbar->SetProgressValue(frame, static_cast<int>(progress * 100), 100); 585 taskbar->SetProgressValue(frame, static_cast<int>(progress * 100), 100);
587 } 586 }
588 #elif defined(TOOLKIT_GTK) 587 #elif defined(TOOLKIT_GTK)
589 unity::SetDownloadCount(download_count); 588 unity::SetDownloadCount(download_count);
590 unity::SetProgressFraction(progress); 589 unity::SetProgressFraction(progress);
591 #endif 590 #endif
592 } 591 }
593 #endif 592 #endif
594 593
595 int GetUniquePathNumberWithCrDownload(const FilePath& path) { 594 int GetUniquePathNumberWithCrDownload(const FilePath& path) {
596 return DownloadFile::GetUniquePathNumberWithSuffix( 595 return file_util::GetUniquePathNumber(
597 path, FILE_PATH_LITERAL(".crdownload")); 596 path, FILE_PATH_LITERAL(".crdownload"));
598 } 597 }
599 598
600 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 599 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
601 return DownloadFile::AppendSuffixToPath( 600 return FilePath(suggested_path.value() + FILE_PATH_LITERAL(".crdownload"));
602 suggested_path, FILE_PATH_LITERAL(".crdownload"));
603 } 601 }
604 602
605 bool IsSavableURL(const GURL& url) { 603 bool IsSavableURL(const GURL& url) {
606 for (int i = 0; chrome::GetSavableSchemes()[i] != NULL; ++i) { 604 for (int i = 0; chrome::GetSavableSchemes()[i] != NULL; ++i) {
607 if (url.SchemeIs(chrome::GetSavableSchemes()[i])) { 605 if (url.SchemeIs(chrome::GetSavableSchemes()[i])) {
608 return true; 606 return true;
609 } 607 }
610 } 608 }
611 return false; 609 return false;
612 } 610 }
(...skipping 16 matching lines...) Expand all
629 kMaxShelfSize); 627 kMaxShelfSize);
630 } 628 }
631 } 629 }
632 630
633 void RecordDownloadCount(ChromeDownloadCountTypes type) { 631 void RecordDownloadCount(ChromeDownloadCountTypes type) {
634 UMA_HISTOGRAM_ENUMERATION( 632 UMA_HISTOGRAM_ENUMERATION(
635 "Download.CountsChrome", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 633 "Download.CountsChrome", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
636 } 634 }
637 635
638 } // namespace download_util 636 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/extensions/webstore_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698