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/location.h" | 7 #include "base/location.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/task_scheduler/post_task.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 15 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
15 #include "chrome/browser/download/download_crx_util.h" | 16 #include "chrome/browser/download/download_crx_util.h" |
16 #include "chrome/browser/download/download_prefs.h" | 17 #include "chrome/browser/download/download_prefs.h" |
17 #include "chrome/browser/history/history_service_factory.h" | 18 #include "chrome/browser/history/history_service_factory.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/safe_browsing/file_type_policies.h" | 21 #include "chrome/common/safe_browsing/file_type_policies.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 next_state_ = STATE_CHECK_DOWNLOAD_URL; | 561 next_state_ = STATE_CHECK_DOWNLOAD_URL; |
561 | 562 |
562 #if defined(OS_WIN) | 563 #if defined(OS_WIN) |
563 if (!local_path_.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) | 564 if (!local_path_.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) |
564 return CONTINUE; | 565 return CONTINUE; |
565 if (!IsAdobeReaderDefaultPDFViewer()) { | 566 if (!IsAdobeReaderDefaultPDFViewer()) { |
566 g_is_adobe_reader_up_to_date_ = false; | 567 g_is_adobe_reader_up_to_date_ = false; |
567 return CONTINUE; | 568 return CONTINUE; |
568 } | 569 } |
569 | 570 |
570 base::PostTaskAndReplyWithResult( | 571 base::PostTaskWithTraitsAndReplyWithResult( |
571 BrowserThread::GetBlockingPool(), | 572 FROM_HERE, base::TaskTraits().MayBlock(), |
572 FROM_HERE, | |
573 base::Bind(&::IsAdobeReaderUpToDate), | 573 base::Bind(&::IsAdobeReaderUpToDate), |
574 base::Bind(&DownloadTargetDeterminer::DetermineIfAdobeReaderUpToDateDone, | 574 base::Bind(&DownloadTargetDeterminer::DetermineIfAdobeReaderUpToDateDone, |
575 weak_ptr_factory_.GetWeakPtr())); | 575 weak_ptr_factory_.GetWeakPtr())); |
576 return QUIT_DOLOOP; | 576 return QUIT_DOLOOP; |
577 #else | 577 #else |
578 return CONTINUE; | 578 return CONTINUE; |
579 #endif | 579 #endif |
580 } | 580 } |
581 | 581 |
582 #if defined(OS_WIN) | 582 #if defined(OS_WIN) |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 const base::FilePath& suggested_path) { | 943 const base::FilePath& suggested_path) { |
944 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 944 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
945 } | 945 } |
946 | 946 |
947 #if defined(OS_WIN) | 947 #if defined(OS_WIN) |
948 // static | 948 // static |
949 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 949 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
950 return g_is_adobe_reader_up_to_date_; | 950 return g_is_adobe_reader_up_to_date_; |
951 } | 951 } |
952 #endif | 952 #endif |
OLD | NEW |