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