OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sessions/restore_tab_helper.h" | 5 #include "chrome/browser/sessions/restore_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
8 #include "chrome/common/extensions/extension_messages.h" | 8 #include "chrome/common/extensions/extension_messages.h" |
9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
| 10 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
11 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
12 | 13 |
13 RestoreTabHelper::RestoreTabHelper(TabContentsWrapper* tab) | 14 RestoreTabHelper::RestoreTabHelper(TabContentsWrapper* tab) |
14 : TabContentsObserver(tab->tab_contents()), | 15 : TabContentsObserver(tab->tab_contents()), |
15 tab_(tab) { | 16 tab_(tab) { |
16 } | 17 } |
17 | 18 |
18 RestoreTabHelper::~RestoreTabHelper() { | 19 RestoreTabHelper::~RestoreTabHelper() { |
19 } | 20 } |
20 | 21 |
21 void RestoreTabHelper::SetWindowID(const SessionID& id) { | 22 void RestoreTabHelper::SetWindowID(const SessionID& id) { |
22 window_id_ = id; | 23 window_id_ = id; |
23 content::NotificationService::current()->Notify( | 24 content::NotificationService::current()->Notify( |
24 content::NOTIFICATION_TAB_PARENTED, | 25 content::NOTIFICATION_TAB_PARENTED, |
25 content::Source<TabContentsWrapper>(tab_), | 26 content::Source<TabContentsWrapper>(tab_), |
26 content::NotificationService::NoDetails()); | 27 content::NotificationService::NoDetails()); |
27 | 28 |
28 // Extension code in the renderer holds the ID of the window that hosts it. | 29 // Extension code in the renderer holds the ID of the window that hosts it. |
29 // Notify it that the window ID changed. | 30 // Notify it that the window ID changed. |
30 tab_->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( | 31 tab_->tab_contents()->render_view_host()->Send( |
31 tab_->render_view_host()->routing_id(), id.id())); | 32 new ExtensionMsg_UpdateBrowserWindowId( |
| 33 tab_->tab_contents()->render_view_host()->routing_id(), id.id())); |
32 } | 34 } |
33 | 35 |
34 void RestoreTabHelper::RenderViewCreated(RenderViewHost* render_view_host) { | 36 void RestoreTabHelper::RenderViewCreated(RenderViewHost* render_view_host) { |
35 render_view_host->Send( | 37 render_view_host->Send( |
36 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->routing_id(), | 38 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->routing_id(), |
37 window_id_.id())); | 39 window_id_.id())); |
38 } | 40 } |
OLD | NEW |