OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ |
7 | 7 |
8 #include "chrome/browser/automation/automation_resource_tracker.h" | 8 #include "chrome/browser/automation/automation_resource_tracker.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 this, NOTIFY_NAV_ENTRY_COMMITTED, | 45 this, NOTIFY_NAV_ENTRY_COMMITTED, |
46 Source<NavigationController>(resource)); | 46 Source<NavigationController>(resource)); |
47 } | 47 } |
48 | 48 |
49 virtual void Observe(NotificationType type, | 49 virtual void Observe(NotificationType type, |
50 const NotificationSource& source, | 50 const NotificationSource& source, |
51 const NotificationDetails& details) { | 51 const NotificationDetails& details) { |
52 switch (type) { | 52 switch (type) { |
53 case NOTIFY_NAV_ENTRY_COMMITTED: | 53 case NOTIFY_NAV_ENTRY_COMMITTED: |
54 last_navigation_times_[Source<NavigationController>(source).ptr()] = | 54 last_navigation_times_[Source<NavigationController>(source).ptr()] = |
55 Time::Now(); | 55 base::Time::Now(); |
56 return; | 56 return; |
57 case NOTIFY_EXTERNAL_TAB_CLOSED: | 57 case NOTIFY_EXTERNAL_TAB_CLOSED: |
58 case NOTIFY_TAB_CLOSING: | 58 case NOTIFY_TAB_CLOSING: |
59 std::map<NavigationController*, Time>::iterator iter = | 59 std::map<NavigationController*, base::Time>::iterator iter = |
60 last_navigation_times_.find( | 60 last_navigation_times_.find( |
61 Source<NavigationController>(source).ptr()); | 61 Source<NavigationController>(source).ptr()); |
62 if (iter != last_navigation_times_.end()) | 62 if (iter != last_navigation_times_.end()) |
63 last_navigation_times_.erase(iter); | 63 last_navigation_times_.erase(iter); |
64 break; | 64 break; |
65 } | 65 } |
66 AutomationResourceTracker::Observe(type, source, details); | 66 AutomationResourceTracker::Observe(type, source, details); |
67 } | 67 } |
68 | 68 |
69 Time GetLastNavigationTime(int handle) { | 69 base::Time GetLastNavigationTime(int handle) { |
70 if (ContainsHandle(handle)) { | 70 if (ContainsHandle(handle)) { |
71 NavigationController* controller = GetResource(handle); | 71 NavigationController* controller = GetResource(handle); |
72 if (controller) { | 72 if (controller) { |
73 std::map<NavigationController*, Time>::const_iterator iter = | 73 std::map<NavigationController*, base::Time>::const_iterator iter = |
74 last_navigation_times_.find(controller); | 74 last_navigation_times_.find(controller); |
75 if (iter != last_navigation_times_.end()) | 75 if (iter != last_navigation_times_.end()) |
76 return iter->second; | 76 return iter->second; |
77 } | 77 } |
78 } | 78 } |
79 return Time(); | 79 return base::Time(); |
80 } | 80 } |
81 | 81 |
82 private: | 82 private: |
83 // Last time a navigation occurred. | 83 // Last time a navigation occurred. |
84 std::map<NavigationController*, Time> last_navigation_times_; | 84 std::map<NavigationController*, base::Time> last_navigation_times_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(AutomationTabTracker); | 86 DISALLOW_COPY_AND_ASSIGN(AutomationTabTracker); |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ | 89 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__ |
90 | 90 |
OLD | NEW |