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/browser_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 const GURL& url) { | 325 const GURL& url) { |
326 WebContents::CreateParams create_params( | 326 WebContents::CreateParams create_params( |
327 params.browser->profile(), | 327 params.browser->profile(), |
328 tab_util::GetSiteInstanceForNewTab(params.browser->profile(), url)); | 328 tab_util::GetSiteInstanceForNewTab(params.browser->profile(), url)); |
329 if (params.source_contents) { | 329 if (params.source_contents) { |
330 create_params.initial_size = | 330 create_params.initial_size = |
331 params.source_contents->GetView()->GetContainerSize(); | 331 params.source_contents->GetView()->GetContainerSize(); |
332 if (params.should_set_opener) | 332 if (params.should_set_opener) |
333 create_params.opener = params.source_contents; | 333 create_params.opener = params.source_contents; |
334 } | 334 } |
335 if (params.disposition == NEW_BACKGROUND_TAB) | |
336 create_params.initially_hidden = true; | |
337 | |
335 #if defined(USE_AURA) | 338 #if defined(USE_AURA) |
336 if (params.browser->window() && | 339 if (params.browser->window() && |
337 params.browser->window()->GetNativeWindow()) { | 340 params.browser->window()->GetNativeWindow()) { |
338 create_params.context = | 341 create_params.context = |
339 params.browser->window()->GetNativeWindow(); | 342 params.browser->window()->GetNativeWindow(); |
340 } | 343 } |
341 #endif | 344 #endif |
342 | 345 |
343 WebContents* target_contents = WebContents::Create(create_params); | 346 WebContents* target_contents = WebContents::Create(create_params); |
344 | 347 |
345 // New tabs can have WebUI URLs that will make calls back to arbitrary | 348 // New tabs can have WebUI URLs that will make calls back to arbitrary |
346 // tab helpers, so the entire set of tab helpers needs to be set up | 349 // tab helpers, so the entire set of tab helpers needs to be set up |
347 // immediately. | 350 // immediately. |
348 BrowserNavigatorWebContentsAdoption::AttachTabHelpers(target_contents); | 351 BrowserNavigatorWebContentsAdoption::AttachTabHelpers(target_contents); |
349 extensions::TabHelper::FromWebContents(target_contents)-> | 352 extensions::TabHelper::FromWebContents(target_contents)-> |
350 SetExtensionAppById(params.extension_app_id); | 353 SetExtensionAppById(params.extension_app_id); |
351 // TODO(sky): Figure out why this is needed. Without it we seem to get | 354 // TODO(sky): Figure out why this is needed. Without it we seem to get |
sky
2013/08/19 20:21:47
I wonder if this can be nuked now (don't feel you
jamesr
2013/08/19 23:50:39
I believe it can - I traced this through and it do
| |
352 // failures in startup tests. | 355 // failures in startup tests. |
353 // By default, content believes it is not hidden. When adding contents | 356 // By default, content believes it is not hidden. When adding contents |
354 // in the background, tell it that it's hidden. | 357 // in the background, tell it that it's hidden. |
355 if ((params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { | 358 if ((params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { |
356 // TabStripModel::AddWebContents invokes WasHidden if not foreground. | 359 // TabStripModel::AddWebContents invokes WasHidden if not foreground. |
357 target_contents->WasHidden(); | 360 target_contents->WasHidden(); |
358 } | 361 } |
359 return target_contents; | 362 return target_contents; |
360 } | 363 } |
361 | 364 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
690 bool reverse_on_redirect = false; | 693 bool reverse_on_redirect = false; |
691 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 694 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
692 &rewritten_url, browser_context, &reverse_on_redirect); | 695 &rewritten_url, browser_context, &reverse_on_redirect); |
693 | 696 |
694 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 697 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
695 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && | 698 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && |
696 rewritten_url.host() == chrome::kChromeUIUberHost); | 699 rewritten_url.host() == chrome::kChromeUIUberHost); |
697 } | 700 } |
698 | 701 |
699 } // namespace chrome | 702 } // namespace chrome |
OLD | NEW |