BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / task_logger.h
blob089bd654d843acd95d76768282c4dc97e74293ae
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_TASK_LOGGER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_TASK_LOGGER_H_
8 #include <deque>
9 #include <string>
10 #include <vector>
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h"
15 #include "base/time/time.h"
17 namespace sync_file_system {
19 class TaskLogger : public base::SupportsWeakPtr<TaskLogger> {
20 public:
21 struct TaskLog {
22 int log_id;
23 base::TimeTicks start_time;
24 base::TimeTicks end_time;
25 std::string task_description;
26 std::string result_description;
27 std::vector<std::string> details;
29 TaskLog();
30 ~TaskLog();
33 typedef std::deque<TaskLog*> LogList;
35 class Observer {
36 public:
37 virtual void OnLogRecorded(const TaskLog& task_log) = 0;
39 protected:
40 Observer() {}
41 virtual ~Observer() {}
43 private:
44 DISALLOW_COPY_AND_ASSIGN(Observer);
47 TaskLogger();
48 ~TaskLogger();
50 void RecordLog(scoped_ptr<TaskLog> log);
51 void ClearLog();
53 void AddObserver(Observer* observer);
54 void RemoveObserver(Observer* observer);
56 const LogList& GetLog() const;
58 private:
59 std::deque<TaskLog*> log_history_;
61 base::ObserverList<Observer> observers_;
63 DISALLOW_COPY_AND_ASSIGN(TaskLogger);
66 } // namespace sync_file_system
68 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_TASK_LOGGER_H_