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/common/content_notification_types.h" |
10 #include "content/common/notification_service.h" | 11 #include "content/common/notification_service.h" |
11 #include "content/common/notification_type.h" | |
12 | 12 |
13 RestoreTabHelper::RestoreTabHelper(TabContentsWrapper* tab) | 13 RestoreTabHelper::RestoreTabHelper(TabContentsWrapper* tab) |
14 : TabContentsObserver(tab->tab_contents()), | 14 : TabContentsObserver(tab->tab_contents()), |
15 tab_(tab) { | 15 tab_(tab) { |
16 } | 16 } |
17 | 17 |
18 RestoreTabHelper::~RestoreTabHelper() { | 18 RestoreTabHelper::~RestoreTabHelper() { |
19 } | 19 } |
20 | 20 |
21 void RestoreTabHelper::SetWindowID(const SessionID& id) { | 21 void RestoreTabHelper::SetWindowID(const SessionID& id) { |
22 window_id_ = id; | 22 window_id_ = id; |
23 NotificationService::current()->Notify( | 23 NotificationService::current()->Notify( |
24 NotificationType::TAB_PARENTED, | 24 content::NOTIFICATION_TAB_PARENTED, |
25 Source<TabContentsWrapper>(tab_), | 25 Source<TabContentsWrapper>(tab_), |
26 NotificationService::NoDetails()); | 26 NotificationService::NoDetails()); |
27 | 27 |
28 // Extension code in the renderer holds the ID of the window that hosts it. | 28 // Extension code in the renderer holds the ID of the window that hosts it. |
29 // Notify it that the window ID changed. | 29 // Notify it that the window ID changed. |
30 tab_->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( | 30 tab_->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( |
31 tab_->render_view_host()->routing_id(), id.id())); | 31 tab_->render_view_host()->routing_id(), id.id())); |
32 } | 32 } |
33 | 33 |
34 void RestoreTabHelper::RenderViewCreated(RenderViewHost* render_view_host) { | 34 void RestoreTabHelper::RenderViewCreated(RenderViewHost* render_view_host) { |
35 render_view_host->Send( | 35 render_view_host->Send( |
36 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->routing_id(), | 36 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->routing_id(), |
37 window_id_.id())); | 37 window_id_.id())); |
38 } | 38 } |
OLD | NEW |