Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_operation_registry.h

Issue 10285002: Revert 134774 because of win aura compile and chromium os browser_test crashes - Created uber tray … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Current state of the transfer; 62 // Current state of the transfer;
63 OperationTransferState transfer_state; 63 OperationTransferState transfer_state;
64 // The time when the operation is initiated. 64 // The time when the operation is initiated.
65 base::Time start_time; 65 base::Time start_time;
66 // Current fraction of progress of the operation. 66 // Current fraction of progress of the operation.
67 int64 progress_current; 67 int64 progress_current;
68 // Expected total number of bytes to be transferred in the operation. 68 // Expected total number of bytes to be transferred in the operation.
69 // -1 if no expectation is available (yet). 69 // -1 if no expectation is available (yet).
70 int64 progress_total; 70 int64 progress_total;
71 }; 71 };
72 typedef std::vector<ProgressStatus> ProgressStatusList;
73 72
74 // Observer interface for listening changes in the active set of operations. 73 // Observer interface for listening changes in the active set of operations.
75 class Observer { 74 class Observer {
76 public: 75 public:
77 // Called when a GData operation started, made some progress, or finished. 76 // Called when a GData operation started, made some progress, or finished.
78 virtual void OnProgressUpdate(const ProgressStatusList& list) = 0; 77 virtual void OnProgressUpdate(const std::vector<ProgressStatus>& list) = 0;
79 protected: 78 protected:
80 virtual ~Observer() {} 79 virtual ~Observer() {}
81 }; 80 };
82 81
83 // Base class for operations that this registry class can maintain. 82 // Base class for operations that this registry class can maintain.
84 // The Operation objects are owned by the registry. In particular, calling 83 // The Operation objects are owned by the registry. In particular, calling
85 // NotifyFinish() causes the registry to delete the Operation object itself. 84 // NotifyFinish() causes the registry to delete the Operation object itself.
86 class Operation { 85 class Operation {
87 public: 86 public:
88 explicit Operation(GDataOperationRegistry* registry); 87 explicit Operation(GDataOperationRegistry* registry);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 }; 121 };
123 122
124 // Cancels all in-flight operations. 123 // Cancels all in-flight operations.
125 void CancelAll(); 124 void CancelAll();
126 125
127 // Cancels ongoing operation for a given virtual |file_path|. Returns true if 126 // Cancels ongoing operation for a given virtual |file_path|. Returns true if
128 // the operation was found and canceled. 127 // the operation was found and canceled.
129 bool CancelForFilePath(const FilePath& file_path); 128 bool CancelForFilePath(const FilePath& file_path);
130 129
131 // Obtains the list of currently active operations. 130 // Obtains the list of currently active operations.
132 ProgressStatusList GetProgressStatusList(); 131 std::vector<ProgressStatus> GetProgressStatusList();
133 132
134 // Sets the observer. 133 // Sets the observer.
135 void AddObserver(Observer* observer); 134 void AddObserver(Observer* observer);
136 void RemoveObserver(Observer* observer); 135 void RemoveObserver(Observer* observer);
137 136
138 private: 137 private:
139 // Handlers for notifications from Operations. 138 // Handlers for notifications from Operations.
140 friend class Operation; 139 friend class Operation;
141 // The registry assigns a fresh operation ID and return it to *id. 140 // The registry assigns a fresh operation ID and return it to *id.
142 void OnOperationStart(Operation* operation, OperationID* id); 141 void OnOperationStart(Operation* operation, OperationID* id);
143 void OnOperationProgress(OperationID operation); 142 void OnOperationProgress(OperationID operation);
144 void OnOperationFinish(OperationID operation); 143 void OnOperationFinish(OperationID operation);
145 void OnOperationSuspend(OperationID operation); 144 void OnOperationSuspend(OperationID operation);
146 void OnOperationResume(Operation* operation, ProgressStatus* new_status); 145 void OnOperationResume(Operation* operation, ProgressStatus* new_status);
147 146
148 bool IsFileTransferOperation(const Operation* operation) const; 147 bool IsFileTransferOperation(const Operation* operation) const;
149 148
150 typedef IDMap<Operation, IDMapOwnPointer> OperationIDMap; 149 typedef IDMap<Operation, IDMapOwnPointer> OperationIDMap;
151 OperationIDMap in_flight_operations_; 150 OperationIDMap in_flight_operations_;
152 ObserverList<Observer> observer_list_; 151 ObserverList<Observer> observer_list_;
153 152
154 DISALLOW_COPY_AND_ASSIGN(GDataOperationRegistry); 153 DISALLOW_COPY_AND_ASSIGN(GDataOperationRegistry);
155 }; 154 };
156 155
157 } // namespace gdata 156 } // namespace gdata
158 157
159 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_ 158 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_delegate.cc ('k') | chrome/browser/chromeos/gdata/gdata_operation_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698