| OLD | NEW | 
|    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 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |    5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 
|    6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |    6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 
|    7  |    7  | 
|    8 #include <string> |    8 #include <string> | 
|    9 #include <vector> |    9 #include <vector> | 
|   10  |   10  | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   60   void set_content_initiated(bool content_initiated) { |   60   void set_content_initiated(bool content_initiated) { | 
|   61     content_initiated_ = content_initiated; |   61     content_initiated_ = content_initiated; | 
|   62   } |   62   } | 
|   63   void add_request_header(const std::string& name, const std::string& value) { |   63   void add_request_header(const std::string& name, const std::string& value) { | 
|   64     request_headers_.push_back(make_pair(name, value)); |   64     request_headers_.push_back(make_pair(name, value)); | 
|   65   } |   65   } | 
|   66   void set_referrer(const Referrer& referrer) { referrer_ = referrer; } |   66   void set_referrer(const Referrer& referrer) { referrer_ = referrer; } | 
|   67   void set_referrer_encoding(const std::string& referrer_encoding) { |   67   void set_referrer_encoding(const std::string& referrer_encoding) { | 
|   68     referrer_encoding_ = referrer_encoding; |   68     referrer_encoding_ = referrer_encoding; | 
|   69   } |   69   } | 
|   70   void set_load_flags(int load_flags) { load_flags_ |= load_flags; } |  | 
|   71   void set_last_modified(const std::string& last_modified) { |   70   void set_last_modified(const std::string& last_modified) { | 
|   72     last_modified_ = last_modified; |   71     last_modified_ = last_modified; | 
|   73   } |   72   } | 
|   74   void set_etag(const std::string& etag) { |   73   void set_etag(const std::string& etag) { | 
|   75     etag_ = etag; |   74     etag_ = etag; | 
|   76   } |   75   } | 
|   77   void set_method(const std::string& method) { |   76   void set_method(const std::string& method) { | 
|   78     method_ = method; |   77     method_ = method; | 
|   79   } |   78   } | 
|   80   void set_post_body(const std::string& post_body) { |   79   void set_post_body(const std::string& post_body) { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   94     save_info_.suggested_name = suggested_name; |   93     save_info_.suggested_name = suggested_name; | 
|   95   } |   94   } | 
|   96   void set_offset(int64 offset) { save_info_.offset = offset; } |   95   void set_offset(int64 offset) { save_info_.offset = offset; } | 
|   97   void set_hash_state(std::string hash_state) { |   96   void set_hash_state(std::string hash_state) { | 
|   98     save_info_.hash_state = hash_state; |   97     save_info_.hash_state = hash_state; | 
|   99   } |   98   } | 
|  100   void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } |   99   void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } | 
|  101   void set_file(base::File file) { |  100   void set_file(base::File file) { | 
|  102     save_info_.file = file.Pass(); |  101     save_info_.file = file.Pass(); | 
|  103   } |  102   } | 
 |  103   void set_do_not_prompt_for_login(bool do_not_prompt) { | 
 |  104     do_not_prompt_for_login_ = do_not_prompt; | 
 |  105   } | 
|  104  |  106  | 
|  105   const OnStartedCallback& callback() const { return callback_; } |  107   const OnStartedCallback& callback() const { return callback_; } | 
|  106   bool content_initiated() const { return content_initiated_; } |  108   bool content_initiated() const { return content_initiated_; } | 
|  107   int load_flags() const { return load_flags_; } |  | 
|  108   const std::string& last_modified() const { return last_modified_; } |  109   const std::string& last_modified() const { return last_modified_; } | 
|  109   const std::string& etag() const { return etag_; } |  110   const std::string& etag() const { return etag_; } | 
|  110   const std::string& method() const { return method_; } |  111   const std::string& method() const { return method_; } | 
|  111   const std::string& post_body() const { return post_body_; } |  112   const std::string& post_body() const { return post_body_; } | 
|  112   int64 post_id() const { return post_id_; } |  113   int64 post_id() const { return post_id_; } | 
|  113   bool prefer_cache() const { return prefer_cache_; } |  114   bool prefer_cache() const { return prefer_cache_; } | 
|  114   const Referrer& referrer() const { return referrer_; } |  115   const Referrer& referrer() const { return referrer_; } | 
|  115   const std::string& referrer_encoding() const { return referrer_encoding_; } |  116   const std::string& referrer_encoding() const { return referrer_encoding_; } | 
|  116   int render_process_host_id() const { return render_process_host_id_; } |  117   int render_process_host_id() const { return render_process_host_id_; } | 
|  117   int render_view_host_routing_id() const { |  118   int render_view_host_routing_id() const { | 
|  118     return render_view_host_routing_id_; |  119     return render_view_host_routing_id_; | 
|  119   } |  120   } | 
|  120   RequestHeadersType::const_iterator request_headers_begin() const { |  121   RequestHeadersType::const_iterator request_headers_begin() const { | 
|  121     return request_headers_.begin(); |  122     return request_headers_.begin(); | 
|  122   } |  123   } | 
|  123   RequestHeadersType::const_iterator request_headers_end() const { |  124   RequestHeadersType::const_iterator request_headers_end() const { | 
|  124     return request_headers_.end(); |  125     return request_headers_.end(); | 
|  125   } |  126   } | 
|  126   content::ResourceContext* resource_context() const { |  127   content::ResourceContext* resource_context() const { | 
|  127     return resource_context_; |  128     return resource_context_; | 
|  128   } |  129   } | 
|  129   const base::FilePath& file_path() const { return save_info_.file_path; } |  130   const base::FilePath& file_path() const { return save_info_.file_path; } | 
|  130   const base::string16& suggested_name() const { |  131   const base::string16& suggested_name() const { | 
|  131     return save_info_.suggested_name; |  132     return save_info_.suggested_name; | 
|  132   } |  133   } | 
|  133   int64 offset() const { return save_info_.offset; } |  134   int64 offset() const { return save_info_.offset; } | 
|  134   const std::string& hash_state() const { return save_info_.hash_state; } |  135   const std::string& hash_state() const { return save_info_.hash_state; } | 
|  135   bool prompt() const { return save_info_.prompt_for_save_location; } |  136   bool prompt() const { return save_info_.prompt_for_save_location; } | 
|  136   const GURL& url() const { return url_; } |  137   const GURL& url() const { return url_; } | 
 |  138   bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 
|  137  |  139  | 
|  138   // Note that this is state changing--the DownloadUrlParameters object |  140   // Note that this is state changing--the DownloadUrlParameters object | 
|  139   // will not have a file attached to it after this call. |  141   // will not have a file attached to it after this call. | 
|  140   base::File GetFile() { return save_info_.file.Pass(); } |  142   base::File GetFile() { return save_info_.file.Pass(); } | 
|  141  |  143  | 
|  142  private: |  144  private: | 
|  143   OnStartedCallback callback_; |  145   OnStartedCallback callback_; | 
|  144   bool content_initiated_; |  146   bool content_initiated_; | 
|  145   RequestHeadersType request_headers_; |  147   RequestHeadersType request_headers_; | 
|  146   int load_flags_; |  | 
|  147   std::string last_modified_; |  148   std::string last_modified_; | 
|  148   std::string etag_; |  149   std::string etag_; | 
|  149   std::string method_; |  150   std::string method_; | 
|  150   std::string post_body_; |  151   std::string post_body_; | 
|  151   int64 post_id_; |  152   int64 post_id_; | 
|  152   bool prefer_cache_; |  153   bool prefer_cache_; | 
|  153   Referrer referrer_; |  154   Referrer referrer_; | 
|  154   std::string referrer_encoding_; |  155   std::string referrer_encoding_; | 
|  155   int render_process_host_id_; |  156   int render_process_host_id_; | 
|  156   int render_view_host_routing_id_; |  157   int render_view_host_routing_id_; | 
|  157   ResourceContext* resource_context_; |  158   ResourceContext* resource_context_; | 
|  158   DownloadSaveInfo save_info_; |  159   DownloadSaveInfo save_info_; | 
|  159   GURL url_; |  160   GURL url_; | 
 |  161   bool do_not_prompt_for_login_; | 
|  160  |  162  | 
|  161   DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |  163   DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 
|  162 }; |  164 }; | 
|  163  |  165  | 
|  164 }  // namespace content |  166 }  // namespace content | 
|  165  |  167  | 
|  166 #endif  // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |  168 #endif  // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 
| OLD | NEW |