| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/default_plugin/plugin_database_handler.h" | 5 #include "chrome/default_plugin/plugin_database_handler.h" |
| 6 | 6 |
| 7 #include <atlbase.h> |
| 8 #include <atlwin.h> |
| 9 |
| 7 #include "libxml/parser.h" | 10 #include "libxml/parser.h" |
| 8 #include "libxml/xpath.h" | 11 #include "libxml/xpath.h" |
| 9 | 12 |
| 10 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 12 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 13 #include "base/string_split.h" | 16 #include "base/string_split.h" |
| 14 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 15 #include "base/time.h" | 18 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return buffer_length; | 114 return buffer_length; |
| 112 } | 115 } |
| 113 | 116 |
| 114 if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { | 117 if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { |
| 115 DVLOG(1) << "About to create plugins file " << plugins_file_; | 118 DVLOG(1) << "About to create plugins file " << plugins_file_; |
| 116 plugin_downloads_file_ = CreateFile(plugins_file_.c_str(), | 119 plugin_downloads_file_ = CreateFile(plugins_file_.c_str(), |
| 117 GENERIC_READ | GENERIC_WRITE, | 120 GENERIC_READ | GENERIC_WRITE, |
| 118 FILE_SHARE_READ, NULL, CREATE_ALWAYS, | 121 FILE_SHARE_READ, NULL, CREATE_ALWAYS, |
| 119 FILE_ATTRIBUTE_NORMAL, NULL); | 122 FILE_ATTRIBUTE_NORMAL, NULL); |
| 120 if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { | 123 if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { |
| 121 unsigned long error = ::GetLastError(); | 124 DWORD error = ::GetLastError(); |
| 122 if (error == ERROR_SHARING_VIOLATION) { | 125 if (error == ERROR_SHARING_VIOLATION) { |
| 123 // File may have been downloaded by another plugin instance on this | 126 // File may have been downloaded by another plugin instance on this |
| 124 // page. | 127 // page. |
| 125 plugin_downloads_file_ = ::CreateFile( | 128 plugin_downloads_file_ = ::CreateFile( |
| 126 plugins_file_.c_str(), GENERIC_READ, | 129 plugins_file_.c_str(), GENERIC_READ, |
| 127 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, | 130 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, |
| 128 FILE_ATTRIBUTE_NORMAL, NULL); | 131 FILE_ATTRIBUTE_NORMAL, NULL); |
| 129 if (plugin_downloads_file_ != INVALID_HANDLE_VALUE) { | 132 if (plugin_downloads_file_ != INVALID_HANDLE_VALUE) { |
| 130 ignore_plugin_db_data_ = true; | 133 ignore_plugin_db_data_ = true; |
| 131 return buffer_length; | 134 return buffer_length; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 348 |
| 346 base::SplitString( | 349 base::SplitString( |
| 347 reinterpret_cast<const char*>(plugin_mime_type_vals->content), | 350 reinterpret_cast<const char*>(plugin_mime_type_vals->content), |
| 348 kMimeTypeSeparator, &plugin_detail->mime_types); | 351 kMimeTypeSeparator, &plugin_detail->mime_types); |
| 349 | 352 |
| 350 plugin_detail->language = | 353 plugin_detail->language = |
| 351 reinterpret_cast<const char*>(plugin_lang_val->content); | 354 reinterpret_cast<const char*>(plugin_lang_val->content); |
| 352 | 355 |
| 353 return true; | 356 return true; |
| 354 } | 357 } |
| OLD | NEW |