diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 20:36:28 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 20:36:28 +0000 |
commit | 822e2947f42a96cc29771f15013fe324037a9712 (patch) | |
tree | a83ff359afec5eb297bf58f2c44cd8037e89dd04 /chrome/browser | |
parent | 0cb7bec2eb1b954e30de75305c974ecfee3c8efb (diff) | |
download | chromium_src-822e2947f42a96cc29771f15013fe324037a9712.zip chromium_src-822e2947f42a96cc29771f15013fe324037a9712.tar.gz chromium_src-822e2947f42a96cc29771f15013fe324037a9712.tar.bz2 |
Turn on file access checks on Win.
BUG=60211
Review URL: http://codereview.chromium.org/4222005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 20 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 2 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shared_resources_data_source.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 9 | ||||
-rw-r--r-- | chrome/browser/io_thread.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 27 |
6 files changed, 41 insertions, 25 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index bf4d385..446bca6 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -376,13 +376,19 @@ void Browser::CreateBrowserWindow() { window_ = BrowserWindow::CreateBrowserWindow(this); #if defined(OS_WIN) - // Set the app user model id for this application to that of the application - // name. See http://crbug.com/7028. - win_util::SetAppIdForWindow( - type_ & TYPE_APP ? - ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : - ShellIntegration::GetChromiumAppId(profile_->GetPath()), - window()->GetNativeHandle()); + { + // TODO: This might hit the disk + // http://code.google.com/p/chromium/issues/detail?id=61638 + base::ThreadRestrictions::ScopedAllowIO allow_io; + + // Set the app user model id for this application to that of the application + // name. See http://crbug.com/7028. + win_util::SetAppIdForWindow( + type_ & TYPE_APP ? + ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : + ShellIntegration::GetChromiumAppId(profile_->GetPath()), + window()->GetNativeHandle()); + } #endif NotificationService::current()->Notify( diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 9e33f68..2452da3 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -483,7 +483,7 @@ void HandleTestParameters(const CommandLine& command_line) { void RunUIMessageLoop(BrowserProcess* browser_process) { TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); -#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) +#if !defined(OS_CHROMEOS) // If the UI thread blocks, the whole UI is unresponsive. // Do not allow disk IO from the UI thread. // TODO(evanm): turn this on for all platforms. diff --git a/chrome/browser/dom_ui/shared_resources_data_source.cc b/chrome/browser/dom_ui/shared_resources_data_source.cc index 43257a2..2c51470 100644 --- a/chrome/browser/dom_ui/shared_resources_data_source.cc +++ b/chrome/browser/dom_ui/shared_resources_data_source.cc @@ -6,6 +6,7 @@ #include "app/resource_bundle.h" #include "base/singleton.h" +#include "base/thread_restrictions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" @@ -79,6 +80,11 @@ void SharedResourcesDataSource::StartDataRequest(const std::string& path, std::string SharedResourcesDataSource::GetMimeType( const std::string& path) const { + // Requests should not block on the disk! On Windows this goes to the + // registry. + // http://code.google.com/p/chromium/issues/detail?id=59849 + base::ThreadRestrictions::ScopedAllowIO allow_io; + std::string mime_type; net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); return mime_type; diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 473a795..d637cda 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -13,6 +13,7 @@ #include "base/stl_util-inl.h" #include "base/string_piece.h" #include "base/string_split.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "base/task.h" #include "base/thread.h" @@ -1158,6 +1159,10 @@ FilePath SavePackage::GetSuggestedNameForSaveAs( } FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { + // The GetMimeTypeFromExtension call will end up going to disk. Do this on + // another thread to avoid slowing the UI thread. http://crbug.com/61775 + base::ThreadRestrictions::ScopedAllowIO allow_io; + // If the file name doesn't have an extension suitable for HTML files, // append one. FilePath::StringType ext = name.Extension(); @@ -1174,6 +1179,10 @@ FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { FilePath SavePackage::EnsureMimeExtension(const FilePath& name, const FilePath::StringType& contents_mime_type) { + // The GetMimeTypeFromExtension call will end up going to disk. Do this on + // another thread to avoid slowing the UI thread. http://crbug.com/61775 + base::ThreadRestrictions::ScopedAllowIO allow_io; + // Start extension at 1 to skip over period if non-empty. FilePath::StringType ext = name.Extension().length() ? name.Extension().substr(1) : name.Extension(); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 55713b7..9f40c50 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -257,7 +257,7 @@ net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( } void IOThread::Init() { -#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) +#if !defined(OS_CHROMEOS) // TODO(evan): test and enable this on all platforms. // Though this thread is called the "IO" thread, it actually just routes // messages around; it shouldn't be allowed to perform any blocking disk I/O. diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index e30970c..e49c463 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -110,6 +110,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/password_form.h" +#include "webkit/glue/plugins/plugin_list.h" // Cross-Site Navigations // @@ -2026,25 +2027,19 @@ void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { DCHECK(!plugin_path.value().empty()); std::wstring plugin_name = plugin_path.ToWStringHack(); -#if defined(OS_WIN) || defined(OS_MACOSX) - scoped_ptr<FileVersionInfo> version_info( - FileVersionInfo::CreateFileVersionInfo(plugin_path)); - if (version_info.get()) { - const std::wstring& product_name = version_info->product_name(); - if (!product_name.empty()) { - plugin_name = product_name; + WebPluginInfo plugin_info; + if (NPAPI::PluginList::Singleton()->GetPluginInfoByPath( + plugin_path, &plugin_info) && + !plugin_info.name.empty()) { + plugin_name = UTF16ToWide(plugin_info.name); #if defined(OS_MACOSX) - // Many plugins on the Mac have .plugin in the actual name, which looks - // terrible, so look for that and strip it off if present. - const std::wstring plugin_extension(L".plugin"); - if (EndsWith(plugin_name, plugin_extension, true)) - plugin_name.erase(plugin_name.length() - plugin_extension.length()); + // Many plugins on the Mac have .plugin in the actual name, which looks + // terrible, so look for that and strip it off if present. + const std::wstring plugin_extension(L".plugin"); + if (EndsWith(plugin_name, plugin_extension, true)) + plugin_name.erase(plugin_name.length() - plugin_extension.length()); #endif // OS_MACOSX - } } -#else - NOTIMPLEMENTED() << " convert plugin path to plugin name"; -#endif SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_INFOBAR_PLUGIN_CRASHED); AddInfoBar(new SimpleAlertInfoBarDelegate( |