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/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // with it. | 319 // with it. |
320 bool SwapInPrerender(TabContents* target_contents, const GURL& url) { | 320 bool SwapInPrerender(TabContents* target_contents, const GURL& url) { |
321 prerender::PrerenderManager* prerender_manager = | 321 prerender::PrerenderManager* prerender_manager = |
322 prerender::PrerenderManagerFactory::GetForProfile( | 322 prerender::PrerenderManagerFactory::GetForProfile( |
323 target_contents->profile()); | 323 target_contents->profile()); |
324 WebContents* web_contents = target_contents->web_contents(); | 324 WebContents* web_contents = target_contents->web_contents(); |
325 return prerender_manager && | 325 return prerender_manager && |
326 prerender_manager->MaybeUsePrerenderedPage(web_contents, url); | 326 prerender_manager->MaybeUsePrerenderedPage(web_contents, url); |
327 } | 327 } |
328 | 328 |
| 329 // Returns true if |url| is something we should try to avoid showing as a main |
| 330 // frame in a normal browser window. |
| 331 bool ShouldNotDisplayUrlInBrowser(Profile* profile, const GURL& url) { |
| 332 ExtensionService* service = profile->GetExtensionService(); |
| 333 return service && service->ShouldNotDisplayUrlInBrowserTab(url); |
| 334 } |
| 335 |
329 } // namespace | 336 } // namespace |
330 | 337 |
331 namespace chrome { | 338 namespace chrome { |
332 | 339 |
333 NavigateParams::NavigateParams(Browser* a_browser, | 340 NavigateParams::NavigateParams(Browser* a_browser, |
334 const GURL& a_url, | 341 const GURL& a_url, |
335 content::PageTransition a_transition) | 342 content::PageTransition a_transition) |
336 : url(a_url), | 343 : url(a_url), |
337 target_contents(NULL), | 344 target_contents(NULL), |
338 source_contents(NULL), | 345 source_contents(NULL), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 393 |
387 void Navigate(NavigateParams* params) { | 394 void Navigate(NavigateParams* params) { |
388 Browser* source_browser = params->browser; | 395 Browser* source_browser = params->browser; |
389 if (source_browser) | 396 if (source_browser) |
390 params->initiating_profile = source_browser->profile(); | 397 params->initiating_profile = source_browser->profile(); |
391 DCHECK(params->initiating_profile); | 398 DCHECK(params->initiating_profile); |
392 | 399 |
393 if (!AdjustNavigateParamsForURL(params)) | 400 if (!AdjustNavigateParamsForURL(params)) |
394 return; | 401 return; |
395 | 402 |
| 403 if (ShouldNotDisplayUrlInBrowser(params->initiating_profile, params->url)) |
| 404 return; |
| 405 |
396 // The browser window may want to adjust the disposition. | 406 // The browser window may want to adjust the disposition. |
397 if (params->disposition == NEW_POPUP && | 407 if (params->disposition == NEW_POPUP && |
398 source_browser && | 408 source_browser && |
399 source_browser->window()) { | 409 source_browser->window()) { |
400 params->disposition = | 410 params->disposition = |
401 source_browser->window()->GetDispositionForPopupBounds( | 411 source_browser->window()->GetDispositionForPopupBounds( |
402 params->window_bounds); | 412 params->window_bounds); |
403 } | 413 } |
404 | 414 |
405 // Adjust disposition for the navigation happending in the sad page of the | 415 // Adjust disposition for the navigation happending in the sad page of the |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 return !(url.scheme() == chrome::kChromeUIScheme && | 611 return !(url.scheme() == chrome::kChromeUIScheme && |
602 (url.host() == chrome::kChromeUISettingsHost || | 612 (url.host() == chrome::kChromeUISettingsHost || |
603 url.host() == chrome::kChromeUISettingsFrameHost || | 613 url.host() == chrome::kChromeUISettingsFrameHost || |
604 url.host() == chrome::kChromeUIExtensionsHost || | 614 url.host() == chrome::kChromeUIExtensionsHost || |
605 url.host() == chrome::kChromeUIBookmarksHost || | 615 url.host() == chrome::kChromeUIBookmarksHost || |
606 url.host() == chrome::kChromeUISyncPromoHost || | 616 url.host() == chrome::kChromeUISyncPromoHost || |
607 url.host() == chrome::kChromeUIUberHost)); | 617 url.host() == chrome::kChromeUIUberHost)); |
608 } | 618 } |
609 | 619 |
610 } // namespace chrome | 620 } // namespace chrome |
OLD | NEW |