| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 } else { | 1543 } else { |
| 1544 *proceed_to_fire_unload = | 1544 *proceed_to_fire_unload = |
| 1545 unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1545 unload_controller_->BeforeUnloadFired(web_contents, proceed); |
| 1546 } | 1546 } |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { | 1549 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { |
| 1550 const content::NavigationEntry* entry = | 1550 const content::NavigationEntry* entry = |
| 1551 source->GetController().GetActiveEntry(); | 1551 source->GetController().GetActiveEntry(); |
| 1552 if (entry) { | 1552 if (entry) { |
| 1553 GURL url = entry->GetURL(); | 1553 const GURL& url = entry->GetURL(); |
| 1554 GURL virtual_url = entry->GetVirtualURL(); | 1554 const GURL& virtual_url = entry->GetVirtualURL(); |
| 1555 if ((url.SchemeIs(content::kChromeUIScheme) && | 1555 if ((url.SchemeIs(content::kChromeUIScheme) && |
| 1556 url.host() == chrome::kChromeUINewTabHost) || | 1556 url.host_piece() == chrome::kChromeUINewTabHost) || |
| 1557 (virtual_url.SchemeIs(content::kChromeUIScheme) && | 1557 (virtual_url.SchemeIs(content::kChromeUIScheme) && |
| 1558 virtual_url.host() == chrome::kChromeUINewTabHost)) { | 1558 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { |
| 1559 return true; | 1559 return true; |
| 1560 } | 1560 } |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 return search::NavEntryIsInstantNTP(source, entry); | 1563 return search::NavEntryIsInstantNTP(source, entry); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { | 1566 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { |
| 1567 DCHECK(source); | 1567 DCHECK(source); |
| 1568 chrome::ViewSource(this, source); | 1568 chrome::ViewSource(this, source); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { | 2050 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { |
| 2051 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); | 2051 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); |
| 2052 // Two cases are handled here: | 2052 // Two cases are handled here: |
| 2053 | 2053 |
| 2054 // - The scheme check is for when an extension page is loaded in a | 2054 // - The scheme check is for when an extension page is loaded in a |
| 2055 // tab, e.g. chrome-extension://id/page.html. | 2055 // tab, e.g. chrome-extension://id/page.html. |
| 2056 // - The extension_app check is for apps, which can have non-extension | 2056 // - The extension_app check is for apps, which can have non-extension |
| 2057 // schemes, e.g. https://mail.google.com if you have the Gmail app | 2057 // schemes, e.g. https://mail.google.com if you have the Gmail app |
| 2058 // installed. | 2058 // installed. |
| 2059 if ((web_contents->GetURL().SchemeIs(extensions::kExtensionScheme) && | 2059 if ((web_contents->GetURL().SchemeIs(extensions::kExtensionScheme) && |
| 2060 web_contents->GetURL().host() == extension->id()) || | 2060 web_contents->GetURL().host_piece() == extension->id()) || |
| 2061 (extensions::TabHelper::FromWebContents(web_contents) | 2061 (extensions::TabHelper::FromWebContents(web_contents) |
| 2062 ->extension_app() == extension)) { | 2062 ->extension_app() == extension)) { |
| 2063 tab_strip_model_->CloseWebContentsAt(i, TabStripModel::CLOSE_NONE); | 2063 tab_strip_model_->CloseWebContentsAt(i, TabStripModel::CLOSE_NONE); |
| 2064 } else { | 2064 } else { |
| 2065 chrome::UnmuteIfMutedByExtension(web_contents, extension->id()); | 2065 chrome::UnmuteIfMutedByExtension(web_contents, extension->id()); |
| 2066 } | 2066 } |
| 2067 } | 2067 } |
| 2068 } | 2068 } |
| 2069 } | 2069 } |
| 2070 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 2070 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 if (contents && !allow_js_access) { | 2596 if (contents && !allow_js_access) { |
| 2597 contents->web_contents()->GetController().LoadURL( | 2597 contents->web_contents()->GetController().LoadURL( |
| 2598 target_url, | 2598 target_url, |
| 2599 content::Referrer(), | 2599 content::Referrer(), |
| 2600 ui::PAGE_TRANSITION_LINK, | 2600 ui::PAGE_TRANSITION_LINK, |
| 2601 std::string()); // No extra headers. | 2601 std::string()); // No extra headers. |
| 2602 } | 2602 } |
| 2603 | 2603 |
| 2604 return contents != NULL; | 2604 return contents != NULL; |
| 2605 } | 2605 } |
| OLD | NEW |