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 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/browser/web_applications/web_app.h" | 33 #include "chrome/browser/web_applications/web_app.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "components/google/core/browser/google_url_tracker.h" | 36 #include "components/google/core/browser/google_url_tracker.h" |
37 #include "content/public/browser/browser_url_handler.h" | 37 #include "content/public/browser/browser_url_handler.h" |
38 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
40 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
42 #include "extensions/browser/extension_registry.h" | |
43 #include "extensions/common/extension.h" | |
44 #include "extensions/common/extension_set.h" | |
45 | 42 |
46 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
47 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 44 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
48 #endif | 45 #endif |
| 46 |
49 #if defined(USE_AURA) | 47 #if defined(USE_AURA) |
50 #include "ui/aura/window.h" | 48 #include "ui/aura/window.h" |
51 #endif | 49 #endif |
52 | 50 |
| 51 #if defined(ENABLE_EXTENSIONS) |
| 52 #include "extensions/browser/extension_registry.h" |
| 53 #include "extensions/common/extension.h" |
| 54 #include "extensions/common/extension_set.h" |
| 55 #endif |
| 56 |
53 using content::GlobalRequestID; | 57 using content::GlobalRequestID; |
54 using content::NavigationController; | 58 using content::NavigationController; |
55 using content::WebContents; | 59 using content::WebContents; |
56 | 60 |
57 class BrowserNavigatorWebContentsAdoption { | 61 class BrowserNavigatorWebContentsAdoption { |
58 public: | 62 public: |
59 static void AttachTabHelpers(content::WebContents* contents) { | 63 static void AttachTabHelpers(content::WebContents* contents) { |
60 TabHelpers::AttachTabHelpers(contents); | 64 TabHelpers::AttachTabHelpers(contents); |
61 } | 65 } |
62 }; | 66 }; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 490 |
487 void Navigate(NavigateParams* params) { | 491 void Navigate(NavigateParams* params) { |
488 Browser* source_browser = params->browser; | 492 Browser* source_browser = params->browser; |
489 if (source_browser) | 493 if (source_browser) |
490 params->initiating_profile = source_browser->profile(); | 494 params->initiating_profile = source_browser->profile(); |
491 DCHECK(params->initiating_profile); | 495 DCHECK(params->initiating_profile); |
492 | 496 |
493 if (!AdjustNavigateParamsForURL(params)) | 497 if (!AdjustNavigateParamsForURL(params)) |
494 return; | 498 return; |
495 | 499 |
| 500 #if defined(ENABLE_EXTENSIONS) |
496 const extensions::Extension* extension = | 501 const extensions::Extension* extension = |
497 extensions::ExtensionRegistry::Get(params->initiating_profile)-> | 502 extensions::ExtensionRegistry::Get(params->initiating_profile)-> |
498 enabled_extensions().GetExtensionOrAppByURL(params->url); | 503 enabled_extensions().GetExtensionOrAppByURL(params->url); |
499 // Platform apps cannot navigate. Block the request. | 504 // Platform apps cannot navigate. Block the request. |
500 if (extension && extension->is_platform_app()) | 505 if (extension && extension->is_platform_app()) |
501 params->url = GURL(chrome::kExtensionInvalidRequestURL); | 506 params->url = GURL(chrome::kExtensionInvalidRequestURL); |
| 507 #endif |
502 | 508 |
503 // The browser window may want to adjust the disposition. | 509 // The browser window may want to adjust the disposition. |
504 if (params->disposition == NEW_POPUP && | 510 if (params->disposition == NEW_POPUP && |
505 source_browser && | 511 source_browser && |
506 source_browser->window()) { | 512 source_browser->window()) { |
507 params->disposition = | 513 params->disposition = |
508 source_browser->window()->GetDispositionForPopupBounds( | 514 source_browser->window()->GetDispositionForPopupBounds( |
509 params->window_bounds); | 515 params->window_bounds); |
510 } | 516 } |
511 | 517 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 bool reverse_on_redirect = false; | 757 bool reverse_on_redirect = false; |
752 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 758 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
753 &rewritten_url, browser_context, &reverse_on_redirect); | 759 &rewritten_url, browser_context, &reverse_on_redirect); |
754 | 760 |
755 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 761 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
756 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 762 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
757 rewritten_url.host() == chrome::kChromeUIUberHost); | 763 rewritten_url.host() == chrome::kChromeUIUberHost); |
758 } | 764 } |
759 | 765 |
760 } // namespace chrome | 766 } // namespace chrome |
OLD | NEW |