OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h" | 5 #include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/sessions/session_tab_helper.h" | 7 #include "chrome/browser/sessions/session_tab_helper.h" |
8 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router.h" | 8 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router.h" |
9 #include "components/sync_sessions/synced_tab_delegate.h" | 9 #include "components/sync_sessions/synced_tab_delegate.h" |
10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 NotifyRouter(); | 45 NotifyRouter(); |
46 } | 46 } |
47 | 47 |
48 void SyncSessionsRouterTabHelper::WebContentsDestroyed() { | 48 void SyncSessionsRouterTabHelper::WebContentsDestroyed() { |
49 NotifyRouter(); | 49 NotifyRouter(); |
50 } | 50 } |
51 | 51 |
52 void SyncSessionsRouterTabHelper::DidFinishLoad( | 52 void SyncSessionsRouterTabHelper::DidFinishLoad( |
53 content::RenderFrameHost* render_frame_host, | 53 content::RenderFrameHost* render_frame_host, |
54 const GURL& validated_url) { | 54 const GURL& validated_url) { |
55 NotifyRouter(); | 55 NotifyRouter(true); |
56 } | 56 } |
57 | 57 |
58 void SyncSessionsRouterTabHelper::DidOpenRequestedURL( | 58 void SyncSessionsRouterTabHelper::DidOpenRequestedURL( |
59 content::WebContents* new_contents, | 59 content::WebContents* new_contents, |
60 content::RenderFrameHost* source_render_frame_host, | 60 content::RenderFrameHost* source_render_frame_host, |
61 const GURL& url, | 61 const GURL& url, |
62 const content::Referrer& referrer, | 62 const content::Referrer& referrer, |
63 WindowOpenDisposition disposition, | 63 WindowOpenDisposition disposition, |
64 ui::PageTransition transition, | 64 ui::PageTransition transition, |
65 bool started_from_context_menu, | 65 bool started_from_context_menu, |
66 bool renderer_initiated) { | 66 bool renderer_initiated) { |
67 SessionID::id_type source_tab_id = SessionTabHelper::IdForTab(web_contents()); | 67 SessionID::id_type source_tab_id = SessionTabHelper::IdForTab(web_contents()); |
68 if (new_contents && | 68 if (new_contents && |
69 SyncSessionsRouterTabHelper::FromWebContents(new_contents) && | 69 SyncSessionsRouterTabHelper::FromWebContents(new_contents) && |
70 new_contents != web_contents() && source_tab_id != kInvalidTabID) { | 70 new_contents != web_contents() && source_tab_id != kInvalidTabID) { |
71 SyncSessionsRouterTabHelper::FromWebContents(new_contents) | 71 SyncSessionsRouterTabHelper::FromWebContents(new_contents) |
72 ->set_source_tab_id(source_tab_id); | 72 ->set_source_tab_id(source_tab_id); |
73 } | 73 } |
74 NotifyRouter(); | 74 NotifyRouter(); |
75 } | 75 } |
76 | 76 |
77 void SyncSessionsRouterTabHelper::NotifyRouter() { | 77 void SyncSessionsRouterTabHelper::NotifyRouter(bool page_load_completed) { |
78 if (router_) | 78 if (router_) |
79 router_->NotifyTabModified(web_contents()); | 79 router_->NotifyTabModified(web_contents(), page_load_completed); |
80 } | 80 } |
81 | 81 |
82 } // namespace sync_sessions | 82 } // namespace sync_sessions |
OLD | NEW |