OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download/download_target_determiner.h" | 5 #include "chrome/browser/download/download_target_determiner.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 11 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
12 #include "chrome/browser/download/download_crx_util.h" | 12 #include "chrome/browser/download/download_crx_util.h" |
13 #include "chrome/browser/download/download_extensions.h" | 13 #include "chrome/browser/download/download_extensions.h" |
14 #include "chrome/browser/download/download_prefs.h" | 14 #include "chrome/browser/download/download_prefs.h" |
15 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
19 #include "components/history/core/browser/history_service.h" | 19 #include "components/history/core/browser/history_service.h" |
| 20 #include "components/mime_util/mime_util.h" |
20 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/download_interrupt_reasons.h" | 23 #include "content/public/browser/download_interrupt_reasons.h" |
23 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
24 #include "net/base/filename_util.h" | 25 #include "net/base/filename_util.h" |
25 #include "net/base/mime_util.h" | |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 #if defined(ENABLE_EXTENSIONS) | 28 #if defined(ENABLE_EXTENSIONS) |
29 #include "chrome/browser/extensions/webstore_installer.h" | 29 #include "chrome/browser/extensions/webstore_installer.h" |
30 #include "extensions/common/feature_switch.h" | 30 #include "extensions/common/feature_switch.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(ENABLE_PLUGINS) | 33 #if defined(ENABLE_PLUGINS) |
34 #include "chrome/browser/plugins/plugin_prefs.h" | 34 #include "chrome/browser/plugins/plugin_prefs.h" |
35 #include "content/public/browser/plugin_service.h" | 35 #include "content/public/browser/plugin_service.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 475 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
476 DCHECK(!virtual_path_.empty()); | 476 DCHECK(!virtual_path_.empty()); |
477 DCHECK(!local_path_.empty()); | 477 DCHECK(!local_path_.empty()); |
478 DCHECK(!is_filetype_handled_safely_); | 478 DCHECK(!is_filetype_handled_safely_); |
479 | 479 |
480 next_state_ = STATE_DETERMINE_IF_ADOBE_READER_UP_TO_DATE; | 480 next_state_ = STATE_DETERMINE_IF_ADOBE_READER_UP_TO_DATE; |
481 | 481 |
482 if (mime_type_.empty()) | 482 if (mime_type_.empty()) |
483 return CONTINUE; | 483 return CONTINUE; |
484 | 484 |
485 if (net::IsSupportedMimeType(mime_type_)) { | 485 if (mime_util::IsSupportedMimeType(mime_type_)) { |
486 is_filetype_handled_safely_ = true; | 486 is_filetype_handled_safely_ = true; |
487 return CONTINUE; | 487 return CONTINUE; |
488 } | 488 } |
489 | 489 |
490 #if defined(ENABLE_PLUGINS) | 490 #if defined(ENABLE_PLUGINS) |
491 BrowserThread::PostTask( | 491 BrowserThread::PostTask( |
492 BrowserThread::IO, | 492 BrowserThread::IO, |
493 FROM_HERE, | 493 FROM_HERE, |
494 base::Bind( | 494 base::Bind( |
495 &IsHandledBySafePlugin, | 495 &IsHandledBySafePlugin, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 const base::FilePath& suggested_path) { | 892 const base::FilePath& suggested_path) { |
893 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 893 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
894 } | 894 } |
895 | 895 |
896 #if defined(OS_WIN) | 896 #if defined(OS_WIN) |
897 // static | 897 // static |
898 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 898 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
899 return g_is_adobe_reader_up_to_date_; | 899 return g_is_adobe_reader_up_to_date_; |
900 } | 900 } |
901 #endif | 901 #endif |
OLD | NEW |