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 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
15 #include "chrome/browser/extensions/api/image_writer_private/image_writer_privat
e_api.h" | 15 #include "chrome/browser/extensions/api/image_writer_private/image_writer_privat
e_api.h" |
16 #include "chrome/browser/extensions/api/image_writer_private/operation.h" | 16 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
17 #include "chrome/common/extensions/api/image_writer_private.h" | 17 #include "chrome/common/extensions/api/image_writer_private.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "extensions/browser/browser_context_keyed_api_factory.h" | 20 #include "extensions/browser/browser_context_keyed_api_factory.h" |
21 #include "extensions/browser/extension_registry_observer.h" | 21 #include "extensions/browser/extension_registry_observer.h" |
| 22 #include "extensions/common/extension_id.h" |
22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
23 | 24 |
24 namespace image_writer_api = extensions::api::image_writer_private; | 25 namespace image_writer_api = extensions::api::image_writer_private; |
25 | 26 |
26 class Profile; | 27 class Profile; |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 class BrowserContext; | 30 class BrowserContext; |
30 } | 31 } |
31 | 32 |
32 namespace extensions { | 33 namespace extensions { |
33 class ExtensionRegistry; | 34 class ExtensionRegistry; |
34 | 35 |
35 namespace image_writer { | 36 namespace image_writer { |
36 | 37 |
37 class Operation; | 38 class Operation; |
38 | 39 |
39 // Manages image writer operations for the current profile. Including clean-up | 40 // Manages image writer operations for the current profile. Including clean-up |
40 // and message routing. | 41 // and message routing. |
41 class OperationManager : public BrowserContextKeyedAPI, | 42 class OperationManager : public BrowserContextKeyedAPI, |
42 public content::NotificationObserver, | 43 public content::NotificationObserver, |
43 public extensions::ExtensionRegistryObserver, | 44 public extensions::ExtensionRegistryObserver, |
44 public base::SupportsWeakPtr<OperationManager> { | 45 public base::SupportsWeakPtr<OperationManager> { |
45 public: | 46 public: |
46 typedef std::string ExtensionId; | |
47 | |
48 explicit OperationManager(content::BrowserContext* context); | 47 explicit OperationManager(content::BrowserContext* context); |
49 ~OperationManager() override; | 48 ~OperationManager() override; |
50 | 49 |
51 void Shutdown() override; | 50 void Shutdown() override; |
52 | 51 |
53 // Starts a WriteFromUrl operation. | 52 // Starts a WriteFromUrl operation. |
54 void StartWriteFromUrl(const ExtensionId& extension_id, | 53 void StartWriteFromUrl(const ExtensionId& extension_id, |
55 GURL url, | 54 GURL url, |
56 const std::string& hash, | 55 const std::string& hash, |
57 const std::string& device_path, | 56 const std::string& device_path, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 119 |
121 base::WeakPtrFactory<OperationManager> weak_factory_; | 120 base::WeakPtrFactory<OperationManager> weak_factory_; |
122 | 121 |
123 DISALLOW_COPY_AND_ASSIGN(OperationManager); | 122 DISALLOW_COPY_AND_ASSIGN(OperationManager); |
124 }; | 123 }; |
125 | 124 |
126 } // namespace image_writer | 125 } // namespace image_writer |
127 } // namespace extensions | 126 } // namespace extensions |
128 | 127 |
129 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_
H_ | 128 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_OPERATION_MANAGER_
H_ |
OLD | NEW |