Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 } else { 1542 } else {
1543 *proceed_to_fire_unload = 1543 *proceed_to_fire_unload =
1544 unload_controller_->BeforeUnloadFired(web_contents, proceed); 1544 unload_controller_->BeforeUnloadFired(web_contents, proceed);
1545 } 1545 }
1546 } 1546 }
1547 1547
1548 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { 1548 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {
1549 const content::NavigationEntry* entry = 1549 const content::NavigationEntry* entry =
1550 source->GetController().GetActiveEntry(); 1550 source->GetController().GetActiveEntry();
1551 if (entry) { 1551 if (entry) {
1552 GURL url = entry->GetURL(); 1552 const GURL& url = entry->GetURL();
1553 GURL virtual_url = entry->GetVirtualURL(); 1553 const GURL& virtual_url = entry->GetVirtualURL();
1554 if ((url.SchemeIs(content::kChromeUIScheme) && 1554 if ((url.SchemeIs(content::kChromeUIScheme) &&
1555 url.host() == chrome::kChromeUINewTabHost) || 1555 url.host_piece() == chrome::kChromeUINewTabHost) ||
1556 (virtual_url.SchemeIs(content::kChromeUIScheme) && 1556 (virtual_url.SchemeIs(content::kChromeUIScheme) &&
1557 virtual_url.host() == chrome::kChromeUINewTabHost)) { 1557 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) {
1558 return true; 1558 return true;
1559 } 1559 }
1560 } 1560 }
1561 1561
1562 return search::NavEntryIsInstantNTP(source, entry); 1562 return search::NavEntryIsInstantNTP(source, entry);
1563 } 1563 }
1564 1564
1565 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { 1565 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) {
1566 DCHECK(source); 1566 DCHECK(source);
1567 chrome::ViewSource(this, source); 1567 chrome::ViewSource(this, source);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { 2037 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) {
2038 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); 2038 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i);
2039 // Two cases are handled here: 2039 // Two cases are handled here:
2040 2040
2041 // - The scheme check is for when an extension page is loaded in a 2041 // - The scheme check is for when an extension page is loaded in a
2042 // tab, e.g. chrome-extension://id/page.html. 2042 // tab, e.g. chrome-extension://id/page.html.
2043 // - The extension_app check is for apps, which can have non-extension 2043 // - The extension_app check is for apps, which can have non-extension
2044 // schemes, e.g. https://mail.google.com if you have the Gmail app 2044 // schemes, e.g. https://mail.google.com if you have the Gmail app
2045 // installed. 2045 // installed.
2046 if ((web_contents->GetURL().SchemeIs(extensions::kExtensionScheme) && 2046 if ((web_contents->GetURL().SchemeIs(extensions::kExtensionScheme) &&
2047 web_contents->GetURL().host() == extension->id()) || 2047 web_contents->GetURL().host_piece() == extension->id()) ||
2048 (extensions::TabHelper::FromWebContents(web_contents) 2048 (extensions::TabHelper::FromWebContents(web_contents)
2049 ->extension_app() == extension)) { 2049 ->extension_app() == extension)) {
2050 tab_strip_model_->CloseWebContentsAt(i, TabStripModel::CLOSE_NONE); 2050 tab_strip_model_->CloseWebContentsAt(i, TabStripModel::CLOSE_NONE);
2051 } else { 2051 } else {
2052 chrome::UnmuteIfMutedByExtension(web_contents, extension->id()); 2052 chrome::UnmuteIfMutedByExtension(web_contents, extension->id());
2053 } 2053 }
2054 } 2054 }
2055 } 2055 }
2056 } 2056 }
2057 #endif // defined(ENABLE_EXTENSIONS) 2057 #endif // defined(ENABLE_EXTENSIONS)
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 if (contents && !allow_js_access) { 2583 if (contents && !allow_js_access) {
2584 contents->web_contents()->GetController().LoadURL( 2584 contents->web_contents()->GetController().LoadURL(
2585 target_url, 2585 target_url,
2586 content::Referrer(), 2586 content::Referrer(),
2587 ui::PAGE_TRANSITION_LINK, 2587 ui::PAGE_TRANSITION_LINK,
2588 std::string()); // No extra headers. 2588 std::string()); // No extra headers.
2589 } 2589 }
2590 2590
2591 return contents != NULL; 2591 return contents != NULL;
2592 } 2592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698