Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/ui/browser_tabrestore.cc

Issue 10917026: Switch Extensions::TabHelper to use WebContents, WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/browser_tabrestore.h" 5 #include "chrome/browser/ui/browser_tabrestore.h"
6 6
7 #include "chrome/browser/extensions/tab_helper.h" 7 #include "chrome/browser/extensions/tab_helper.h"
8 #include "chrome/browser/sessions/session_service.h" 8 #include "chrome/browser/sessions/session_service.h"
9 #include "chrome/browser/sessions/session_service_factory.h" 9 #include "chrome/browser/sessions/session_service_factory.h"
10 #include "chrome/browser/tab_contents/tab_util.h" 10 #include "chrome/browser/tab_contents/tab_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // into the map. 50 // into the map.
51 content::SessionStorageNamespaceMap session_storage_namespace_map; 51 content::SessionStorageNamespaceMap session_storage_namespace_map;
52 session_storage_namespace_map[""] = session_storage_namespace; 52 session_storage_namespace_map[""] = session_storage_namespace;
53 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( 53 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory(
54 browser->profile(), 54 browser->profile(),
55 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), 55 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url),
56 MSG_ROUTING_NONE, 56 MSG_ROUTING_NONE,
57 chrome::GetActiveWebContents(browser), 57 chrome::GetActiveWebContents(browser),
58 session_storage_namespace_map); 58 session_storage_namespace_map);
59 WebContents* new_tab = tab_contents->web_contents(); 59 WebContents* new_tab = tab_contents->web_contents();
60 tab_contents->extension_tab_helper()->SetExtensionAppById(extension_app_id); 60 extensions::TabHelper::FromWebContents(new_tab)->
61 SetExtensionAppById(extension_app_id);
61 std::vector<NavigationEntry*> entries; 62 std::vector<NavigationEntry*> entries;
62 TabNavigation::CreateNavigationEntriesFromTabNavigations( 63 TabNavigation::CreateNavigationEntriesFromTabNavigations(
63 browser->profile(), navigations, &entries); 64 browser->profile(), navigations, &entries);
64 new_tab->SetUserAgentOverride(user_agent_override); 65 new_tab->SetUserAgentOverride(user_agent_override);
65 new_tab->GetController().Restore( 66 new_tab->GetController().Restore(
66 selected_navigation, from_last_session, &entries); 67 selected_navigation, from_last_session, &entries);
67 DCHECK_EQ(0u, entries.size()); 68 DCHECK_EQ(0u, entries.size());
68 69
69 int add_types = select ? TabStripModel::ADD_ACTIVE : 70 int add_types = select ? TabStripModel::ADD_ACTIVE :
70 TabStripModel::ADD_NONE; 71 TabStripModel::ADD_NONE;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // session_storage_namespace.h include since we only need that to assign 112 // session_storage_namespace.h include since we only need that to assign
112 // into the map. 113 // into the map.
113 content::SessionStorageNamespaceMap session_storage_namespace_map; 114 content::SessionStorageNamespaceMap session_storage_namespace_map;
114 session_storage_namespace_map[""] = session_storage_namespace; 115 session_storage_namespace_map[""] = session_storage_namespace;
115 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( 116 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory(
116 browser->profile(), 117 browser->profile(),
117 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), 118 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url),
118 MSG_ROUTING_NONE, 119 MSG_ROUTING_NONE,
119 GetActiveWebContents(browser), 120 GetActiveWebContents(browser),
120 session_storage_namespace_map); 121 session_storage_namespace_map);
121 tab_contents->extension_tab_helper()->SetExtensionAppById(extension_app_id);
122 WebContents* replacement = tab_contents->web_contents(); 122 WebContents* replacement = tab_contents->web_contents();
123 extensions::TabHelper::FromWebContents(replacement)->
124 SetExtensionAppById(extension_app_id);
123 replacement->SetUserAgentOverride(user_agent_override); 125 replacement->SetUserAgentOverride(user_agent_override);
124 std::vector<NavigationEntry*> entries; 126 std::vector<NavigationEntry*> entries;
125 TabNavigation::CreateNavigationEntriesFromTabNavigations( 127 TabNavigation::CreateNavigationEntriesFromTabNavigations(
126 browser->profile(), navigations, &entries); 128 browser->profile(), navigations, &entries);
127 replacement->GetController().Restore( 129 replacement->GetController().Restore(
128 selected_navigation, from_last_session, &entries); 130 selected_navigation, from_last_session, &entries);
129 DCHECK_EQ(0u, entries.size()); 131 DCHECK_EQ(0u, entries.size());
130 132
131 browser->tab_strip_model()->ReplaceNavigationControllerAt( 133 browser->tab_strip_model()->ReplaceNavigationControllerAt(
132 browser->active_index(), 134 browser->active_index(),
133 tab_contents); 135 tab_contents);
134 } 136 }
135 137
136 } // namespace chrome 138 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698