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_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
11 | 11 |
12 class CoreTabHelperDelegate; | 12 class CoreTabHelperDelegate; |
13 | 13 |
14 // Per-tab class to handle functionality that is core to the operation of tabs. | 14 // Per-tab class to handle functionality that is core to the operation of tabs. |
15 class CoreTabHelper : public content::WebContentsObserver, | 15 class CoreTabHelper : public content::WebContentsObserver, |
16 public content::WebContentsUserData<CoreTabHelper> { | 16 public content::WebContentsUserData<CoreTabHelper> { |
17 public: | 17 public: |
18 virtual ~CoreTabHelper(); | 18 virtual ~CoreTabHelper(); |
19 | 19 |
20 // Initial title assigned to NavigationEntries from Navigate. | 20 // Initial title assigned to NavigationEntries from Navigate. |
21 static string16 GetDefaultTitle(); | 21 static string16 GetDefaultTitle(); |
22 | 22 |
23 // Returns a human-readable description the tab's loading state. | 23 // Returns a human-readable description the tab's loading state. |
24 string16 GetStatusText() const; | 24 string16 GetStatusText() const; |
25 | 25 |
| 26 // True if view is in the process of being detached from it's containing tab |
| 27 // as part of tab closure. |
| 28 bool GetWebContentsDetachedToClose() const; |
| 29 |
26 // Notification that tab closing has started. This can be called multiple | 30 // Notification that tab closing has started. This can be called multiple |
27 // times, subsequent calls are ignored. | 31 // times, subsequent calls are ignored. |
28 void OnCloseStarted(); | 32 void OnCloseStarted(); |
29 | 33 |
30 // Notification that tab closing was cancelled. This can happen when a user | 34 // Notification that tab closing was cancelled. This can happen when a user |
31 // cancels a window close via another tab's beforeunload dialog. | 35 // cancels a window close via another tab's beforeunload dialog. |
32 void OnCloseCanceled(); | 36 void OnCloseCanceled(); |
33 | 37 |
34 // Set the time during close when unload is started. Normally, this is set | 38 // Set the time during close when unload is started. Normally, this is set |
35 // after the beforeunload dialog. However, for a window close, it is set | 39 // after the beforeunload dialog. However, for a window close, it is set |
36 // after all the beforeunload dialogs have finished. | 40 // after all the beforeunload dialogs have finished. |
37 void OnUnloadStarted(); | 41 void OnUnloadStarted(); |
38 | 42 |
| 43 // Called just before making the tab invisible on close. |
| 44 void OnUnloadAboutToDetach(); |
| 45 |
39 // Set the time during close when the tab is no longer visible. | 46 // Set the time during close when the tab is no longer visible. |
40 void OnUnloadDetachedStarted(); | 47 void OnUnloadDetachedStarted(); |
41 | 48 |
42 CoreTabHelperDelegate* delegate() const { return delegate_; } | 49 CoreTabHelperDelegate* delegate() const { return delegate_; } |
43 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } | 50 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } |
44 | 51 |
45 void set_new_tab_start_time(const base::TimeTicks& time) { | 52 void set_new_tab_start_time(const base::TimeTicks& time) { |
46 new_tab_start_time_ = time; | 53 new_tab_start_time_ = time; |
47 } | 54 } |
48 | 55 |
(...skipping 19 matching lines...) Expand all Loading... |
68 | 75 |
69 // The time that we started to close this WebContents. | 76 // The time that we started to close this WebContents. |
70 base::TimeTicks close_start_time_; | 77 base::TimeTicks close_start_time_; |
71 | 78 |
72 // The time when onbeforeunload ended. | 79 // The time when onbeforeunload ended. |
73 base::TimeTicks before_unload_end_time_; | 80 base::TimeTicks before_unload_end_time_; |
74 | 81 |
75 // The time when the tab was removed from view during close. | 82 // The time when the tab was removed from view during close. |
76 base::TimeTicks unload_detached_start_time_; | 83 base::TimeTicks unload_detached_start_time_; |
77 | 84 |
| 85 // True if the tab was removed from a view during close. |
| 86 bool detached_as_part_of_unload_; |
| 87 |
78 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); | 88 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); |
79 }; | 89 }; |
80 | 90 |
81 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 91 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
OLD | NEW |