| 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/external_tab_container_win.h" | 5 #include "chrome/browser/external_tab_container_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 NOTREACHED(); | 173 NOTREACHED(); |
| 174 return false; | 174 return false; |
| 175 } | 175 } |
| 176 | 176 |
| 177 // TODO(jcampan): limit focus traversal to contents. | 177 // TODO(jcampan): limit focus traversal to contents. |
| 178 | 178 |
| 179 prop_.reset(new ViewProp(GetNativeView(), kWindowObjectKey, this)); | 179 prop_.reset(new ViewProp(GetNativeView(), kWindowObjectKey, this)); |
| 180 | 180 |
| 181 if (existing_contents) { | 181 if (existing_contents) { |
| 182 tab_contents_.reset(existing_contents); | 182 tab_contents_.reset(existing_contents); |
| 183 tab_contents_->tab_contents()->GetController().set_browser_context(profile); | 183 tab_contents_->web_contents()->GetController().SetBrowserContext(profile); |
| 184 } else { | 184 } else { |
| 185 TabContents* new_contents = new TabContents(profile, NULL, MSG_ROUTING_NONE, | 185 TabContents* new_contents = new TabContents(profile, NULL, MSG_ROUTING_NONE, |
| 186 NULL, NULL); | 186 NULL, NULL); |
| 187 tab_contents_.reset(new TabContentsWrapper(new_contents)); | 187 tab_contents_.reset(new TabContentsWrapper(new_contents)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 if (!infobars_enabled) | 190 if (!infobars_enabled) |
| 191 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); | 191 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); |
| 192 | 192 |
| 193 tab_contents_->tab_contents()->SetDelegate(this); | 193 tab_contents_->tab_contents()->SetDelegate(this); |
| 194 | 194 |
| 195 tab_contents_->tab_contents()-> | 195 tab_contents_->tab_contents()-> |
| 196 GetMutableRendererPrefs()->browser_handles_top_level_requests = | 196 GetMutableRendererPrefs()->browser_handles_top_level_requests = |
| 197 handle_top_level_requests; | 197 handle_top_level_requests; |
| 198 | 198 |
| 199 if (!existing_contents) { | 199 if (!existing_contents) { |
| 200 tab_contents_->tab_contents()->GetRenderViewHost()->AllowBindings( | 200 tab_contents_->tab_contents()->GetRenderViewHost()->AllowBindings( |
| 201 content::BINDINGS_POLICY_EXTERNAL_HOST); | 201 content::BINDINGS_POLICY_EXTERNAL_HOST); |
| 202 } | 202 } |
| 203 | 203 |
| 204 NavigationController* controller = | 204 content::NavigationController* controller = |
| 205 &tab_contents_->web_contents()->GetController(); | 205 &tab_contents_->web_contents()->GetController(); |
| 206 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 206 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 207 content::Source<content::NavigationController>(controller)); | 207 content::Source<content::NavigationController>(controller)); |
| 208 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 208 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 209 content::Source<content::NavigationController>(controller)); | 209 content::Source<content::NavigationController>(controller)); |
| 210 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 210 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 211 content::Source<content::NavigationController>(controller)); | 211 content::Source<content::NavigationController>(controller)); |
| 212 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 212 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 213 content::Source<WebContents>(tab_contents_->web_contents())); | 213 content::Source<WebContents>(tab_contents_->web_contents())); |
| 214 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 214 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 if (params.disposition == CURRENT_TAB) { | 1200 if (params.disposition == CURRENT_TAB) { |
| 1201 DCHECK(route_all_top_level_navigations_); | 1201 DCHECK(route_all_top_level_navigations_); |
| 1202 forward_params.disposition = NEW_FOREGROUND_TAB; | 1202 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1203 } | 1203 } |
| 1204 WebContents* new_contents = | 1204 WebContents* new_contents = |
| 1205 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1205 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
| 1206 // support only one navigation for a dummy tab before it is killed. | 1206 // support only one navigation for a dummy tab before it is killed. |
| 1207 ::DestroyWindow(GetNativeView()); | 1207 ::DestroyWindow(GetNativeView()); |
| 1208 return new_contents; | 1208 return new_contents; |
| 1209 } | 1209 } |
| OLD | NEW |