OLD | NEW |
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/views/external_tab_container_win.h" | 5 #include "chrome/browser/ui/views/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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // TODO(jcampan): limit focus traversal to contents. | 187 // TODO(jcampan): limit focus traversal to contents. |
188 | 188 |
189 prop_.reset(new ViewProp(GetNativeView(), kWindowObjectKey, this)); | 189 prop_.reset(new ViewProp(GetNativeView(), kWindowObjectKey, this)); |
190 | 190 |
191 if (existing_contents) { | 191 if (existing_contents) { |
192 tab_contents_.reset(existing_contents); | 192 tab_contents_.reset(existing_contents); |
193 tab_contents_->web_contents()->GetController().SetBrowserContext(profile); | 193 tab_contents_->web_contents()->GetController().SetBrowserContext(profile); |
194 } else { | 194 } else { |
195 WebContents* new_contents = WebContents::Create( | 195 WebContents* new_contents = WebContents::Create( |
196 profile, NULL, MSG_ROUTING_NONE, NULL); | 196 profile, NULL, MSG_ROUTING_NONE, NULL); |
197 tab_contents_.reset(new TabContents(new_contents)); | 197 tab_contents_.reset(TabContents::Factory::CreateTabContents(new_contents)); |
198 } | 198 } |
199 | 199 |
200 if (!infobars_enabled) | 200 if (!infobars_enabled) |
201 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); | 201 tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); |
202 | 202 |
203 tab_contents_->web_contents()->SetDelegate(this); | 203 tab_contents_->web_contents()->SetDelegate(this); |
204 | 204 |
205 tab_contents_->web_contents()-> | 205 tab_contents_->web_contents()-> |
206 GetMutableRendererPrefs()->browser_handles_non_local_top_level_requests = | 206 GetMutableRendererPrefs()->browser_handles_non_local_top_level_requests = |
207 handle_top_level_requests; | 207 handle_top_level_requests; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Reuse the same tab handle here as the new container instance is a dummy | 482 // Reuse the same tab handle here as the new container instance is a dummy |
483 // instance which does not have an automation client connected at the other | 483 // instance which does not have an automation client connected at the other |
484 // end. | 484 // end. |
485 new_container = new TemporaryPopupExternalTabContainerWin( | 485 new_container = new TemporaryPopupExternalTabContainerWin( |
486 automation_, automation_resource_message_filter_.get()); | 486 automation_, automation_resource_message_filter_.get()); |
487 new_container->SetTabHandle(tab_handle_); | 487 new_container->SetTabHandle(tab_handle_); |
488 } | 488 } |
489 | 489 |
490 // Make sure that ExternalTabContainer instance is initialized with | 490 // Make sure that ExternalTabContainer instance is initialized with |
491 // an unwrapped Profile. | 491 // an unwrapped Profile. |
492 scoped_ptr<TabContents> tab_contents(new TabContents(new_contents)); | 492 scoped_ptr<TabContents> tab_contents( |
| 493 TabContents::Factory::CreateTabContents(new_contents)); |
493 bool result = new_container->Init( | 494 bool result = new_container->Init( |
494 tab_contents->profile()->GetOriginalProfile(), | 495 tab_contents->profile()->GetOriginalProfile(), |
495 NULL, | 496 NULL, |
496 initial_pos, | 497 initial_pos, |
497 WS_CHILD, | 498 WS_CHILD, |
498 load_requests_via_automation_, | 499 load_requests_via_automation_, |
499 handle_top_level_requests_, | 500 handle_top_level_requests_, |
500 tab_contents.get(), | 501 tab_contents.get(), |
501 GURL(), | 502 GURL(), |
502 GURL(), | 503 GURL(), |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 if (params.disposition == CURRENT_TAB) { | 1255 if (params.disposition == CURRENT_TAB) { |
1255 DCHECK(route_all_top_level_navigations_); | 1256 DCHECK(route_all_top_level_navigations_); |
1256 forward_params.disposition = NEW_FOREGROUND_TAB; | 1257 forward_params.disposition = NEW_FOREGROUND_TAB; |
1257 } | 1258 } |
1258 WebContents* new_contents = | 1259 WebContents* new_contents = |
1259 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1260 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
1260 // support only one navigation for a dummy tab before it is killed. | 1261 // support only one navigation for a dummy tab before it is killed. |
1261 ::DestroyWindow(GetNativeView()); | 1262 ::DestroyWindow(GetNativeView()); |
1262 return new_contents; | 1263 return new_contents; |
1263 } | 1264 } |
OLD | NEW |