OLD | NEW |
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_AUTOMATION_AUTOMATION_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/tab_contents/web_contents_user_data.h" | 14 #include "chrome/browser/common/web_contents_user_data.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 | 16 |
17 class AutomationTabHelper; | 17 class AutomationTabHelper; |
18 | 18 |
19 // An observer API implemented by classes which are interested in various | 19 // An observer API implemented by classes which are interested in various |
20 // tab events from AutomationTabHelper(s). | 20 // tab events from AutomationTabHelper(s). |
21 class TabEventObserver { | 21 class TabEventObserver { |
22 public: | 22 public: |
23 // |LOAD_START| and |LOAD_STOP| notifications may occur several times for a | 23 // |LOAD_START| and |LOAD_STOP| notifications may occur several times for a |
24 // sequence of loads that may appear as one complete navigation to a user. | 24 // sequence of loads that may appear as one complete navigation to a user. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Dumps a heap profile. | 92 // Dumps a heap profile. |
93 void HeapProfilerDump(const std::string& reason); | 93 void HeapProfilerDump(const std::string& reason); |
94 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) | 94 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) |
95 | 95 |
96 // Returns true if the tab is loading or the tab is scheduled to load | 96 // Returns true if the tab is loading or the tab is scheduled to load |
97 // immediately. Note that scheduled loads may be canceled. | 97 // immediately. Note that scheduled loads may be canceled. |
98 bool has_pending_loads() const; | 98 bool has_pending_loads() const; |
99 | 99 |
100 private: | 100 private: |
101 explicit AutomationTabHelper(content::WebContents* web_contents); | 101 explicit AutomationTabHelper(content::WebContents* web_contents); |
102 static int kUserDataKey; | |
103 friend class WebContentsUserData<AutomationTabHelper>; | 102 friend class WebContentsUserData<AutomationTabHelper>; |
104 | 103 |
105 friend class AutomationTabHelperTest; | 104 friend class AutomationTabHelperTest; |
106 | 105 |
107 void OnSnapshotEntirePageACK( | 106 void OnSnapshotEntirePageACK( |
108 bool success, | 107 bool success, |
109 const std::vector<unsigned char>& png_data, | 108 const std::vector<unsigned char>& png_data, |
110 const std::string& error_msg); | 109 const std::string& error_msg); |
111 | 110 |
112 // content::WebContentsObserver implementation. | 111 // content::WebContentsObserver implementation. |
(...skipping 18 matching lines...) Expand all Loading... |
131 // redirect. | 130 // redirect. |
132 std::set<int64> pending_client_redirects_; | 131 std::set<int64> pending_client_redirects_; |
133 | 132 |
134 // List of all the |TabEventObserver|s, which we broadcast events to. | 133 // List of all the |TabEventObserver|s, which we broadcast events to. |
135 ObserverList<TabEventObserver> observers_; | 134 ObserverList<TabEventObserver> observers_; |
136 | 135 |
137 DISALLOW_COPY_AND_ASSIGN(AutomationTabHelper); | 136 DISALLOW_COPY_AND_ASSIGN(AutomationTabHelper); |
138 }; | 137 }; |
139 | 138 |
140 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_HELPER_H_ | 139 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_HELPER_H_ |
OLD | NEW |