- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync_file_system / drive_backend_v1 / origin_operation_queue.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_ORIGIN_OPERATION_QUEUE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_ORIGIN_OPERATION_QUEUE_H_
7
8 #include <deque>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "url/gurl.h"
13
14 namespace sync_file_system {
15
16 struct OriginOperation {
17   enum Type {
18     UNKNOWN,
19     REGISTERING,
20     ENABLING,
21     DISABLING,
22     UNINSTALLING
23   };
24
25   GURL origin;
26   Type type;
27
28   OriginOperation();
29   OriginOperation(const GURL& origin, Type type);
30   ~OriginOperation();
31 };
32
33 class OriginOperationQueue {
34  public:
35   OriginOperationQueue();
36   ~OriginOperationQueue();
37
38   void Push(const GURL& origin, OriginOperation::Type type);
39   OriginOperation Pop();
40   bool HasPendingOperation(const GURL& origin) const;
41
42   size_t size() const { return queue_.size(); }
43   bool empty() const { return queue_.empty(); }
44
45  private:
46   std::deque<OriginOperation> queue_;
47 };
48
49 }  // namespace sync_file_system
50
51 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_ORIGIN_OPERATION_QUEUE_H_