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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 // 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 16 matching lines...) Expand all
27 #include "base/values.h" 27 #include "base/values.h"
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #include "chrome/browser/download/download_create_info.h" 29 #include "chrome/browser/download/download_create_info.h"
30 #include "chrome/browser/download/download_extensions.h" 30 #include "chrome/browser/download/download_extensions.h"
31 #include "chrome/browser/download/download_item.h" 31 #include "chrome/browser/download/download_item.h"
32 #include "chrome/browser/download/download_item_model.h" 32 #include "chrome/browser/download/download_item_model.h"
33 #include "chrome/browser/download/download_manager.h" 33 #include "chrome/browser/download/download_manager.h"
34 #include "chrome/browser/download/download_types.h" 34 #include "chrome/browser/download/download_types.h"
35 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/ui/browser.h" 36 #include "chrome/browser/ui/browser.h"
37 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/chrome_paths.h" 38 #include "chrome/common/chrome_paths.h"
38 #include "chrome/common/time_format.h" 39 #include "chrome/common/time_format.h"
39 #include "content/browser/browser_thread.h" 40 #include "content/browser/browser_thread.h"
40 #include "content/browser/renderer_host/render_view_host.h" 41 #include "content/browser/renderer_host/render_view_host.h"
41 #include "content/browser/renderer_host/resource_dispatcher_host.h" 42 #include "content/browser/renderer_host/resource_dispatcher_host.h"
42 #include "content/browser/tab_contents/tab_contents.h" 43 #include "content/browser/tab_contents/tab_contents.h"
43 #include "content/common/notification_service.h" 44 #include "content/common/notification_service.h"
44 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
45 #include "grit/locale_settings.h" 46 #include "grit/locale_settings.h"
46 #include "grit/theme_resources.h" 47 #include "grit/theme_resources.h"
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 *context); 854 *context);
854 } 855 }
855 856
856 void NotifyDownloadInitiated(int render_process_id, int render_view_id) { 857 void NotifyDownloadInitiated(int render_process_id, int render_view_id) {
857 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 858 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
858 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, 859 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id,
859 render_view_id); 860 render_view_id);
860 if (!rvh) 861 if (!rvh)
861 return; 862 return;
862 863
863 NotificationService::current()->Notify(NotificationType::DOWNLOAD_INITIATED, 864 NotificationService::current()->Notify(
864 Source<RenderViewHost>(rvh), 865 chrome::NOTIFICATION_DOWNLOAD_INITIATED, Source<RenderViewHost>(rvh),
865 NotificationService::NoDetails()); 866 NotificationService::NoDetails());
866 } 867 }
867 868
868 int GetUniquePathNumberWithCrDownload(const FilePath& path) { 869 int GetUniquePathNumberWithCrDownload(const FilePath& path) {
869 if (!file_util::PathExists(path) && 870 if (!file_util::PathExists(path) &&
870 !file_util::PathExists(GetCrDownloadPath(path))) 871 !file_util::PathExists(GetCrDownloadPath(path)))
871 return 0; 872 return 0;
872 873
873 FilePath new_path; 874 FilePath new_path;
874 for (int count = 1; count <= kMaxUniqueFiles; ++count) { 875 for (int count = 1; count <= kMaxUniqueFiles; ++count) {
875 new_path = FilePath(path); 876 new_path = FilePath(path);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 908 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
908 FilePath::StringType file_name; 909 FilePath::StringType file_name;
909 base::SStringPrintf( 910 base::SStringPrintf(
910 &file_name, 911 &file_name,
911 PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), 912 PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"),
912 suggested_path.value().c_str()); 913 suggested_path.value().c_str());
913 return FilePath(file_name); 914 return FilePath(file_name);
914 } 915 }
915 916
916 } // namespace download_util 917 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | chrome/browser/download/mhtml_generation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698