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 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" | 5 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" |
6 | 6 |
7 #include "content/public/browser/navigation_handle.h" | 7 #include "content/public/browser/navigation_handle.h" |
8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 content::RenderFrameHost* render_frame_host) { | 28 content::RenderFrameHost* render_frame_host) { |
29 if (!render_frame_host->GetParent()) { | 29 if (!render_frame_host->GetParent()) { |
30 is_document_loaded_in_main_frame_ = true; | 30 is_document_loaded_in_main_frame_ = true; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 void WebContentsMainFrameObserver::DidFinishNavigation( | 34 void WebContentsMainFrameObserver::DidFinishNavigation( |
35 content::NavigationHandle* navigation_handle) { | 35 content::NavigationHandle* navigation_handle) { |
36 if (!navigation_handle->IsInMainFrame() || | 36 if (!navigation_handle->IsInMainFrame() || |
37 !navigation_handle->HasCommitted() || | 37 !navigation_handle->HasCommitted() || |
38 navigation_handle->IsSamePage()) { | 38 navigation_handle->IsSameDocument()) { |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 is_document_loaded_in_main_frame_ = false; | 42 is_document_loaded_in_main_frame_ = false; |
43 is_initialized_ = true; | 43 is_initialized_ = true; |
44 } | 44 } |
45 | 45 |
46 void WebContentsMainFrameObserver::RenderProcessGone( | 46 void WebContentsMainFrameObserver::RenderProcessGone( |
47 base::TerminationStatus status) { | 47 base::TerminationStatus status) { |
48 CleanUp(); | 48 CleanUp(); |
49 } | 49 } |
50 | 50 |
51 void WebContentsMainFrameObserver::CleanUp() { | 51 void WebContentsMainFrameObserver::CleanUp() { |
52 content::WebContentsObserver::Observe(NULL); | 52 content::WebContentsObserver::Observe(NULL); |
53 } | 53 } |
54 | 54 |
55 } // namespace dom_distiller | 55 } // namespace dom_distiller |
OLD | NEW |