download_create_info.h revision 201ade2fbba22bfb27ae029f4d23fca6ded109a0
1// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4// 5// Download creation struct used for querying the history service. 6 7#ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_CREATE_INFO_H_ 8#define CHROME_BROWSER_HISTORY_DOWNLOAD_CREATE_INFO_H_ 9#pragma once 10 11#include <string> 12 13#include "base/basictypes.h" 14#include "base/file_path.h" 15#include "base/time.h" 16#include "chrome/browser/download/download_file.h" 17#include "googleurl/src/gurl.h" 18 19// Used for informing the download database of a new download, where we don't 20// want to pass DownloadItems between threads. The history service also uses a 21// vector of these structs for passing us the state of all downloads at 22// initialization time (see DownloadQueryInfo below). 23struct DownloadCreateInfo { 24 DownloadCreateInfo(const FilePath& path, 25 const GURL& url, 26 base::Time start_time, 27 int64 received_bytes, 28 int64 total_bytes, 29 int32 state, 30 int32 download_id); 31 DownloadCreateInfo(); 32 ~DownloadCreateInfo(); 33 34 std::string DebugString() const; 35 36 // DownloadItem fields 37 FilePath path; 38 GURL url; 39 GURL referrer_url; 40 FilePath suggested_path; 41 // A number that should be added to the suggested path to make it unique. 42 // 0 means no number should be appended. Not actually stored in the db. 43 int path_uniquifier; 44 base::Time start_time; 45 int64 received_bytes; 46 int64 total_bytes; 47 int32 state; 48 int32 download_id; 49 int child_id; 50 int render_view_id; 51 int request_id; 52 int64 db_handle; 53 std::string content_disposition; 54 std::string mime_type; 55 // The value of the content type header sent with the downloaded item. It 56 // may be different from |mime_type|, which may be set based on heuristics 57 // which may look at the file extension and first few bytes of the file. 58 std::string original_mime_type; 59 60 // True if we should display the 'save as...' UI and prompt the user 61 // for the download location. 62 // False if the UI should be supressed and the download performed to the 63 // default location. 64 bool prompt_user_for_save_location; 65 // Whether this download is potentially dangerous (ex: exe, dll, ...). 66 bool is_dangerous; 67 // The original name for a dangerous download. 68 FilePath original_name; 69 // Whether this download is for extension install or not. 70 bool is_extension_install; 71 // The charset of the referring page where the download request comes from. 72 // It's used to construct a suggested filename. 73 std::string referrer_charset; 74 // The download file save info. 75 DownloadSaveInfo save_info; 76}; 77 78#endif // CHROME_BROWSER_HISTORY_DOWNLOAD_CREATE_INFO_H_ 79