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/extensions/api/image_writer_private/operation.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 14 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
15 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 15 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "third_party/zlib/google/zip_reader.h" | 17 #include "third_party/zlib/google/zip_reader.h" |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 namespace image_writer { | 20 namespace image_writer { |
21 | 21 |
22 using content::BrowserThread; | 22 using content::BrowserThread; |
23 | 23 |
24 const int kMD5BufferSize = 1024; | 24 const int kMD5BufferSize = 1024; |
25 | 25 |
26 #if !defined(OS_CHROMEOS) | 26 #if !defined(OS_CHROMEOS) |
27 static base::LazyInstance<scoped_refptr<ImageWriterUtilityClient> > | 27 static base::LazyInstance<scoped_refptr<ImageWriterUtilityClient>>:: |
28 g_utility_client = LAZY_INSTANCE_INITIALIZER; | 28 DestructorAtExit g_utility_client = LAZY_INSTANCE_INITIALIZER; |
29 #endif | 29 #endif |
30 | 30 |
31 Operation::Operation(base::WeakPtr<OperationManager> manager, | 31 Operation::Operation(base::WeakPtr<OperationManager> manager, |
32 const ExtensionId& extension_id, | 32 const ExtensionId& extension_id, |
33 const std::string& device_path, | 33 const std::string& device_path, |
34 const base::FilePath& download_folder) | 34 const base::FilePath& download_folder) |
35 : manager_(manager), | 35 : manager_(manager), |
36 extension_id_(extension_id), | 36 extension_id_(extension_id), |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 device_path_(base::FilePath::FromUTF8Unsafe(device_path)), | 38 device_path_(base::FilePath::FromUTF8Unsafe(device_path)), |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin(); | 378 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin(); |
379 it != cleanup_functions_.end(); | 379 it != cleanup_functions_.end(); |
380 ++it) { | 380 ++it) { |
381 it->Run(); | 381 it->Run(); |
382 } | 382 } |
383 cleanup_functions_.clear(); | 383 cleanup_functions_.clear(); |
384 } | 384 } |
385 | 385 |
386 } // namespace image_writer | 386 } // namespace image_writer |
387 } // namespace extensions | 387 } // namespace extensions |
OLD | NEW |