| 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_PRERENDER_PRERENDER_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 EVENT_LOGGED_IN_TABLE_PRESENT = 1, | 37 EVENT_LOGGED_IN_TABLE_PRESENT = 1, |
| 38 EVENT_MAINFRAME_CHANGE = 2, | 38 EVENT_MAINFRAME_CHANGE = 2, |
| 39 EVENT_MAINFRAME_CHANGE_DOMAIN_LOGGED_IN = 3, | 39 EVENT_MAINFRAME_CHANGE_DOMAIN_LOGGED_IN = 3, |
| 40 EVENT_MAINFRAME_COMMIT = 4, | 40 EVENT_MAINFRAME_COMMIT = 4, |
| 41 EVENT_MAINFRAME_COMMIT_DOMAIN_LOGGED_IN = 5, | 41 EVENT_MAINFRAME_COMMIT_DOMAIN_LOGGED_IN = 5, |
| 42 EVENT_LOGIN_ACTION_ADDED = 6, | 42 EVENT_LOGIN_ACTION_ADDED = 6, |
| 43 EVENT_LOGIN_ACTION_ADDED_PW_EMPTY = 7, | 43 EVENT_LOGIN_ACTION_ADDED_PW_EMPTY = 7, |
| 44 EVENT_MAX_VALUE | 44 EVENT_MAX_VALUE |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 static void CreateForWebContentsWithPasswordManager( | |
| 48 content::WebContents* web_contents, | |
| 49 password_manager::PasswordManager* password_manager); | |
| 50 | |
| 51 ~PrerenderTabHelper() override; | 47 ~PrerenderTabHelper() override; |
| 52 | 48 |
| 53 // content::WebContentsObserver implementation. | 49 // content::WebContentsObserver implementation. |
| 50 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
| 54 void DidGetRedirectForResourceRequest( | 51 void DidGetRedirectForResourceRequest( |
| 55 content::RenderViewHost* render_view_host, | 52 content::RenderViewHost* render_view_host, |
| 56 const content::ResourceRedirectDetails& details) override; | 53 const content::ResourceRedirectDetails& details) override; |
| 57 void DidStopLoading(content::RenderViewHost* render_view_host) override; | 54 void DidStopLoading(content::RenderViewHost* render_view_host) override; |
| 58 void DidStartProvisionalLoadForFrame( | 55 void DidStartProvisionalLoadForFrame( |
| 59 content::RenderFrameHost* render_frame_host, | 56 content::RenderFrameHost* render_frame_host, |
| 60 const GURL& validated_url, | 57 const GURL& validated_url, |
| 61 bool is_error_page, | 58 bool is_error_page, |
| 62 bool is_iframe_srcdoc) override; | 59 bool is_iframe_srcdoc) override; |
| 63 void DidCommitProvisionalLoadForFrame( | 60 void DidCommitProvisionalLoadForFrame( |
| 64 content::RenderFrameHost* render_frame_host, | 61 content::RenderFrameHost* render_frame_host, |
| 65 const GURL& validated_url, | 62 const GURL& validated_url, |
| 66 ui::PageTransition transition_type) override; | 63 ui::PageTransition transition_type) override; |
| 67 | 64 |
| 68 // Called when the URL of the main frame changed, either when the load | 65 // Called when the URL of the main frame changed, either when the load |
| 69 // commits, or a redirect happens. | 66 // commits, or a redirect happens. |
| 70 void MainFrameUrlDidChange(const GURL& url); | 67 void MainFrameUrlDidChange(const GURL& url); |
| 71 | 68 |
| 72 // Called when a password form has been submitted. | 69 // Called when a password form has been submitted. |
| 73 void PasswordSubmitted(const autofill::PasswordForm& form); | 70 void PasswordSubmitted(const autofill::PasswordForm& form); |
| 74 | 71 |
| 75 // Called when this prerendered WebContents has just been swapped in. | 72 // Called when this prerendered WebContents has just been swapped in. |
| 76 void PrerenderSwappedIn(); | 73 void PrerenderSwappedIn(); |
| 77 | 74 |
| 78 // Called when a control prerender is resolved. Applies to the next load. | 75 // Called when a control prerender is resolved. Applies to the next load. |
| 79 void WouldHavePrerenderedNextLoad(Origin origin); | 76 void WouldHavePrerenderedNextLoad(Origin origin); |
| 80 | 77 |
| 81 private: | 78 private: |
| 82 PrerenderTabHelper(content::WebContents* web_contents, | 79 explicit PrerenderTabHelper(content::WebContents* web_contents); |
| 83 password_manager::PasswordManager* password_manager); | |
| 84 friend class content::WebContentsUserData<PrerenderTabHelper>; | 80 friend class content::WebContentsUserData<PrerenderTabHelper>; |
| 85 | 81 |
| 86 void RecordEvent(Event event) const; | 82 void RecordEvent(Event event) const; |
| 87 void RecordEventIfLoggedInURL(Event event, const GURL& url); | 83 void RecordEventIfLoggedInURL(Event event, const GURL& url); |
| 88 void RecordEventIfLoggedInURLResult(Event event, scoped_ptr<bool> is_present, | 84 void RecordEventIfLoggedInURLResult(Event event, scoped_ptr<bool> is_present, |
| 89 scoped_ptr<bool> lookup_succeeded); | 85 scoped_ptr<bool> lookup_succeeded); |
| 90 | 86 |
| 91 void RecordPerceivedPageLoadTime( | 87 void RecordPerceivedPageLoadTime( |
| 92 base::TimeDelta perceived_page_load_time, | 88 base::TimeDelta perceived_page_load_time, |
| 93 double fraction_plt_elapsed_at_swap_in); | 89 double fraction_plt_elapsed_at_swap_in); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 GURL url_; | 124 GURL url_; |
| 129 | 125 |
| 130 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; | 126 base::WeakPtrFactory<PrerenderTabHelper> weak_factory_; |
| 131 | 127 |
| 132 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); | 128 DISALLOW_COPY_AND_ASSIGN(PrerenderTabHelper); |
| 133 }; | 129 }; |
| 134 | 130 |
| 135 } // namespace prerender | 131 } // namespace prerender |
| 136 | 132 |
| 137 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ | 133 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ |
| OLD | NEW |