| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.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 10 matching lines...) Expand all Loading... |
| 21 virtual ~WebContentsMainFrameObserver(); | 21 virtual ~WebContentsMainFrameObserver(); |
| 22 | 22 |
| 23 bool is_document_loaded_in_main_frame() { | 23 bool is_document_loaded_in_main_frame() { |
| 24 return is_document_loaded_in_main_frame_; | 24 return is_document_loaded_in_main_frame_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool is_initialized() { return is_initialized_; } | 27 bool is_initialized() { return is_initialized_; } |
| 28 | 28 |
| 29 // content::WebContentsObserver implementation. | 29 // content::WebContentsObserver implementation. |
| 30 virtual void DocumentLoadedInFrame( | 30 virtual void DocumentLoadedInFrame( |
| 31 content::RenderFrameHost* render_frame_host) OVERRIDE; | 31 content::RenderFrameHost* render_frame_host) override; |
| 32 virtual void DidNavigateMainFrame( | 32 virtual void DidNavigateMainFrame( |
| 33 const content::LoadCommittedDetails& details, | 33 const content::LoadCommittedDetails& details, |
| 34 const content::FrameNavigateParams& params) OVERRIDE; | 34 const content::FrameNavigateParams& params) override; |
| 35 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 35 virtual void RenderProcessGone(base::TerminationStatus status) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 explicit WebContentsMainFrameObserver(content::WebContents* web_contents); | 38 explicit WebContentsMainFrameObserver(content::WebContents* web_contents); |
| 39 friend class content::WebContentsUserData<WebContentsMainFrameObserver>; | 39 friend class content::WebContentsUserData<WebContentsMainFrameObserver>; |
| 40 | 40 |
| 41 // Removes the observer and clears the WebContents member. | 41 // Removes the observer and clears the WebContents member. |
| 42 void CleanUp(); | 42 void CleanUp(); |
| 43 | 43 |
| 44 // Whether DocumentLoadedInFrame has been called for the tracked WebContents | 44 // Whether DocumentLoadedInFrame has been called for the tracked WebContents |
| 45 // for the current main frame. This is cleared when the main frame navigates, | 45 // for the current main frame. This is cleared when the main frame navigates, |
| 46 // and set again when DocumentLoadedInFrame is called for the main frame. | 46 // and set again when DocumentLoadedInFrame is called for the main frame. |
| 47 bool is_document_loaded_in_main_frame_; | 47 bool is_document_loaded_in_main_frame_; |
| 48 | 48 |
| 49 // Whether this object has been correctly initialized. This is set as soon as | 49 // Whether this object has been correctly initialized. This is set as soon as |
| 50 // at least one call to DidNavigateMainFrame has happened. | 50 // at least one call to DidNavigateMainFrame has happened. |
| 51 bool is_initialized_; | 51 bool is_initialized_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebContentsMainFrameObserver); | 53 DISALLOW_COPY_AND_ASSIGN(WebContentsMainFrameObserver); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace dom_distiller | 56 } // namespace dom_distiller |
| 57 | 57 |
| 58 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ | 58 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_WEB_CONTENTS_MAIN_FRAME_OBSERVER_H_ |
| OLD | NEW |