| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/history/core/browser/history_service.h" | 22 #include "components/history/core/browser/history_service.h" |
| 23 #include "components/mime_util/mime_util.h" | 23 #include "components/mime_util/mime_util.h" |
| 24 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
| 25 #include "content/public/browser/browser_context.h" | 25 #include "content/public/browser/browser_context.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/download_interrupt_reasons.h" | 27 #include "content/public/browser/download_interrupt_reasons.h" |
| 28 #include "extensions/common/constants.h" | 28 #include "extensions/common/constants.h" |
| 29 #include "net/base/filename_util.h" | 29 #include "net/base/filename_util.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "url/origin.h" |
| 31 | 32 |
| 32 #if defined(ENABLE_EXTENSIONS) | 33 #if defined(ENABLE_EXTENSIONS) |
| 33 #include "chrome/browser/extensions/webstore_installer.h" | 34 #include "chrome/browser/extensions/webstore_installer.h" |
| 34 #include "extensions/common/feature_switch.h" | 35 #include "extensions/common/feature_switch.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 #if defined(ENABLE_PLUGINS) | 38 #if defined(ENABLE_PLUGINS) |
| 38 #include "chrome/browser/plugins/plugin_prefs.h" | 39 #include "chrome/browser/plugins/plugin_prefs.h" |
| 39 #include "content/public/browser/plugin_service.h" | 40 #include "content/public/browser/plugin_service.h" |
| 40 #include "content/public/common/webplugininfo.h" | 41 #include "content/public/common/webplugininfo.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 467 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 467 DCHECK(!mime_type.empty()); | 468 DCHECK(!mime_type.empty()); |
| 468 using content::WebPluginInfo; | 469 using content::WebPluginInfo; |
| 469 | 470 |
| 470 std::string actual_mime_type; | 471 std::string actual_mime_type; |
| 471 bool is_stale = false; | 472 bool is_stale = false; |
| 472 WebPluginInfo plugin_info; | 473 WebPluginInfo plugin_info; |
| 473 | 474 |
| 474 content::PluginService* plugin_service = | 475 content::PluginService* plugin_service = |
| 475 content::PluginService::GetInstance(); | 476 content::PluginService::GetInstance(); |
| 476 bool plugin_found = plugin_service->GetPluginInfo(-1, -1, resource_context, | 477 bool plugin_found = plugin_service->GetPluginInfo( |
| 477 url, GURL(), mime_type, | 478 -1, -1, resource_context, url, url::Origin(), mime_type, false, &is_stale, |
| 478 false, &is_stale, | 479 &plugin_info, &actual_mime_type); |
| 479 &plugin_info, | |
| 480 &actual_mime_type); | |
| 481 if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) { | 480 if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) { |
| 482 // The GetPlugins call causes the plugin list to be refreshed. Once that's | 481 // The GetPlugins call causes the plugin list to be refreshed. Once that's |
| 483 // done we can retry the GetPluginInfo call. We break out of this cycle | 482 // done we can retry the GetPluginInfo call. We break out of this cycle |
| 484 // after a single retry in order to avoid retrying indefinitely. | 483 // after a single retry in order to avoid retrying indefinitely. |
| 485 plugin_service->GetPlugins( | 484 plugin_service->GetPlugins( |
| 486 base::Bind(&InvokeClosureAfterGetPluginCallback, | 485 base::Bind(&InvokeClosureAfterGetPluginCallback, |
| 487 base::Bind(&IsHandledBySafePlugin, | 486 base::Bind(&IsHandledBySafePlugin, |
| 488 resource_context, | 487 resource_context, |
| 489 url, | 488 url, |
| 490 mime_type, | 489 mime_type, |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 const base::FilePath& suggested_path) { | 945 const base::FilePath& suggested_path) { |
| 947 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 946 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
| 948 } | 947 } |
| 949 | 948 |
| 950 #if defined(OS_WIN) | 949 #if defined(OS_WIN) |
| 951 // static | 950 // static |
| 952 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 951 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
| 953 return g_is_adobe_reader_up_to_date_; | 952 return g_is_adobe_reader_up_to_date_; |
| 954 } | 953 } |
| 955 #endif | 954 #endif |
| OLD | NEW |