OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 } | 1542 } |
1543 | 1543 |
1544 void Browser::ShowRepostFormWarningDialog(WebContents* source) { | 1544 void Browser::ShowRepostFormWarningDialog(WebContents* source) { |
1545 TabModalConfirmDialog::Create(new RepostFormWarningController(source), | 1545 TabModalConfirmDialog::Create(new RepostFormWarningController(source), |
1546 source); | 1546 source); |
1547 } | 1547 } |
1548 | 1548 |
1549 bool Browser::ShouldCreateWebContents( | 1549 bool Browser::ShouldCreateWebContents( |
1550 WebContents* web_contents, | 1550 WebContents* web_contents, |
1551 int route_id, | 1551 int route_id, |
| 1552 int main_frame_route_id, |
1552 WindowContainerType window_container_type, | 1553 WindowContainerType window_container_type, |
1553 const base::string16& frame_name, | 1554 const base::string16& frame_name, |
1554 const GURL& target_url, | 1555 const GURL& target_url, |
1555 const std::string& partition_id, | 1556 const std::string& partition_id, |
1556 content::SessionStorageNamespace* session_storage_namespace) { | 1557 content::SessionStorageNamespace* session_storage_namespace) { |
1557 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 1558 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
1558 // If a BackgroundContents is created, suppress the normal WebContents. | 1559 // If a BackgroundContents is created, suppress the normal WebContents. |
1559 return !MaybeCreateBackgroundContents(route_id, | 1560 return !MaybeCreateBackgroundContents(route_id, |
| 1561 main_frame_route_id, |
1560 web_contents, | 1562 web_contents, |
1561 frame_name, | 1563 frame_name, |
1562 target_url, | 1564 target_url, |
1563 partition_id, | 1565 partition_id, |
1564 session_storage_namespace); | 1566 session_storage_namespace); |
1565 } | 1567 } |
1566 | 1568 |
1567 return true; | 1569 return true; |
1568 } | 1570 } |
1569 | 1571 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 } | 2426 } |
2425 | 2427 |
2426 bool Browser::ShouldHideUIForFullscreen() const { | 2428 bool Browser::ShouldHideUIForFullscreen() const { |
2427 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash | 2429 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash |
2428 // keep the controls in a slide-down panel. | 2430 // keep the controls in a slide-down panel. |
2429 return window_ && window_->ShouldHideUIForFullscreen(); | 2431 return window_ && window_->ShouldHideUIForFullscreen(); |
2430 } | 2432 } |
2431 | 2433 |
2432 bool Browser::MaybeCreateBackgroundContents( | 2434 bool Browser::MaybeCreateBackgroundContents( |
2433 int route_id, | 2435 int route_id, |
| 2436 int main_frame_route_id, |
2434 WebContents* opener_web_contents, | 2437 WebContents* opener_web_contents, |
2435 const base::string16& frame_name, | 2438 const base::string16& frame_name, |
2436 const GURL& target_url, | 2439 const GURL& target_url, |
2437 const std::string& partition_id, | 2440 const std::string& partition_id, |
2438 content::SessionStorageNamespace* session_storage_namespace) { | 2441 content::SessionStorageNamespace* session_storage_namespace) { |
2439 GURL opener_url = opener_web_contents->GetURL(); | 2442 GURL opener_url = opener_web_contents->GetURL(); |
2440 ExtensionService* extensions_service = | 2443 ExtensionService* extensions_service = |
2441 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 2444 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
2442 | 2445 |
2443 if (!opener_url.is_valid() || | 2446 if (!opener_url.is_valid() || |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2489 // new SiteInstance, so that a separate process is used. | 2492 // new SiteInstance, so that a separate process is used. |
2490 scoped_refptr<content::SiteInstance> site_instance = | 2493 scoped_refptr<content::SiteInstance> site_instance = |
2491 allow_js_access ? | 2494 allow_js_access ? |
2492 opener_site_instance : | 2495 opener_site_instance : |
2493 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); | 2496 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); |
2494 | 2497 |
2495 // Passed all the checks, so this should be created as a BackgroundContents. | 2498 // Passed all the checks, so this should be created as a BackgroundContents. |
2496 BackgroundContents* contents = | 2499 BackgroundContents* contents = |
2497 service->CreateBackgroundContents(site_instance.get(), | 2500 service->CreateBackgroundContents(site_instance.get(), |
2498 route_id, | 2501 route_id, |
| 2502 main_frame_route_id, |
2499 profile_, | 2503 profile_, |
2500 frame_name, | 2504 frame_name, |
2501 base::ASCIIToUTF16(extension->id()), | 2505 base::ASCIIToUTF16(extension->id()), |
2502 partition_id, | 2506 partition_id, |
2503 session_storage_namespace); | 2507 session_storage_namespace); |
2504 | 2508 |
2505 // When a separate process is used, the original renderer cannot access the | 2509 // When a separate process is used, the original renderer cannot access the |
2506 // new window later, thus we need to navigate the window now. | 2510 // new window later, thus we need to navigate the window now. |
2507 if (contents && !allow_js_access) { | 2511 if (contents && !allow_js_access) { |
2508 contents->web_contents()->GetController().LoadURL( | 2512 contents->web_contents()->GetController().LoadURL( |
2509 target_url, | 2513 target_url, |
2510 content::Referrer(), | 2514 content::Referrer(), |
2511 ui::PAGE_TRANSITION_LINK, | 2515 ui::PAGE_TRANSITION_LINK, |
2512 std::string()); // No extra headers. | 2516 std::string()); // No extra headers. |
2513 } | 2517 } |
2514 | 2518 |
2515 return contents != NULL; | 2519 return contents != NULL; |
2516 } | 2520 } |
OLD | NEW |