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/time.h" | 8 #include "base/time/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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 void OnCloseCanceled(); | 32 void OnCloseCanceled(); |
33 | 33 |
34 // Set the time during close when unload is started. Normally, this is set | 34 // 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 | 35 // after the beforeunload dialog. However, for a window close, it is set |
36 // after all the beforeunload dialogs have finished. | 36 // after all the beforeunload dialogs have finished. |
37 void OnUnloadStarted(); | 37 void OnUnloadStarted(); |
38 | 38 |
39 // Set the time during close when the tab is no longer visible. | 39 // Set the time during close when the tab is no longer visible. |
40 void OnUnloadDetachedStarted(); | 40 void OnUnloadDetachedStarted(); |
41 | 41 |
| 42 void UpdateContentRestrictions(int content_restrictions); |
| 43 |
42 CoreTabHelperDelegate* delegate() const { return delegate_; } | 44 CoreTabHelperDelegate* delegate() const { return delegate_; } |
43 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } | 45 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } |
44 | 46 |
45 void set_new_tab_start_time(const base::TimeTicks& time) { | 47 void set_new_tab_start_time(const base::TimeTicks& time) { |
46 new_tab_start_time_ = time; | 48 new_tab_start_time_ = time; |
47 } | 49 } |
48 | 50 |
49 base::TimeTicks new_tab_start_time() const { return new_tab_start_time_; } | 51 base::TimeTicks new_tab_start_time() const { return new_tab_start_time_; } |
| 52 int content_restrictions() const { return content_restrictions_; } |
50 | 53 |
51 private: | 54 private: |
52 explicit CoreTabHelper(content::WebContents* web_contents); | 55 explicit CoreTabHelper(content::WebContents* web_contents); |
53 friend class content::WebContentsUserData<CoreTabHelper>; | 56 friend class content::WebContentsUserData<CoreTabHelper>; |
54 | 57 |
55 // content::WebContentsObserver overrides: | 58 // content::WebContentsObserver overrides: |
| 59 virtual void DidStartLoading( |
| 60 content::RenderViewHost* render_view_host) OVERRIDE; |
56 virtual void WasShown() OVERRIDE; | 61 virtual void WasShown() OVERRIDE; |
57 virtual void WebContentsDestroyed( | 62 virtual void WebContentsDestroyed( |
58 content::WebContents* web_contents) OVERRIDE; | 63 content::WebContents* web_contents) OVERRIDE; |
59 virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) OVERRIDE; | 64 virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) OVERRIDE; |
60 virtual void BeforeUnloadDialogCancelled() OVERRIDE; | 65 virtual void BeforeUnloadDialogCancelled() OVERRIDE; |
61 | 66 |
62 // Delegate for notifying our owner about stuff. Not owned by us. | 67 // Delegate for notifying our owner about stuff. Not owned by us. |
63 CoreTabHelperDelegate* delegate_; | 68 CoreTabHelperDelegate* delegate_; |
64 | 69 |
65 // The time when we started to create the new tab page. This time is from | 70 // The time when we started to create the new tab page. This time is from |
66 // before we created this WebContents. | 71 // before we created this WebContents. |
67 base::TimeTicks new_tab_start_time_; | 72 base::TimeTicks new_tab_start_time_; |
68 | 73 |
69 // The time that we started to close this WebContents. | 74 // The time that we started to close this WebContents. |
70 base::TimeTicks close_start_time_; | 75 base::TimeTicks close_start_time_; |
71 | 76 |
72 // The time when onbeforeunload ended. | 77 // The time when onbeforeunload ended. |
73 base::TimeTicks before_unload_end_time_; | 78 base::TimeTicks before_unload_end_time_; |
74 | 79 |
75 // The time when the tab was removed from view during close. | 80 // The time when the tab was removed from view during close. |
76 base::TimeTicks unload_detached_start_time_; | 81 base::TimeTicks unload_detached_start_time_; |
77 | 82 |
| 83 // Content restrictions, used to disable print/copy etc based on content's |
| 84 // (full-page plugins for now only) permissions. |
| 85 int content_restrictions_; |
| 86 |
78 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); | 87 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); |
79 }; | 88 }; |
80 | 89 |
81 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ | 90 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ |
OLD | NEW |