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/macros.h" | 10 #include "base/macros.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(ENABLE_EXTENSIONS) | 50 #if defined(ENABLE_EXTENSIONS) |
51 #include "chrome/browser/extensions/tab_helper.h" | 51 #include "chrome/browser/extensions/tab_helper.h" |
52 #include "chrome/browser/web_applications/web_app.h" | 52 #include "chrome/browser/web_applications/web_app.h" |
53 #include "extensions/browser/extension_registry.h" | 53 #include "extensions/browser/extension_registry.h" |
54 #include "extensions/common/extension.h" | 54 #include "extensions/common/extension.h" |
55 #include "extensions/common/extension_set.h" | 55 #include "extensions/common/extension_set.h" |
56 #endif | 56 #endif |
57 | 57 |
58 #if !defined(OS_ANDROID) | |
59 #include "chrome/browser/metrics/first_web_contents_profiler.h" | |
60 #endif // !defined(OS_ANDROID) | |
61 | |
62 using content::GlobalRequestID; | 58 using content::GlobalRequestID; |
63 using content::NavigationController; | 59 using content::NavigationController; |
64 using content::WebContents; | 60 using content::WebContents; |
65 | 61 |
66 class BrowserNavigatorWebContentsAdoption { | 62 class BrowserNavigatorWebContentsAdoption { |
67 public: | 63 public: |
68 static void AttachTabHelpers(content::WebContents* contents) { | 64 static void AttachTabHelpers(content::WebContents* contents) { |
69 TabHelpers::AttachTabHelpers(contents); | 65 TabHelpers::AttachTabHelpers(contents); |
70 | 66 |
71 // Make the tab show up in the task manager. | 67 // Make the tab show up in the task manager. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 374 |
379 // New tabs can have WebUI URLs that will make calls back to arbitrary | 375 // New tabs can have WebUI URLs that will make calls back to arbitrary |
380 // tab helpers, so the entire set of tab helpers needs to be set up | 376 // tab helpers, so the entire set of tab helpers needs to be set up |
381 // immediately. | 377 // immediately. |
382 BrowserNavigatorWebContentsAdoption::AttachTabHelpers(target_contents); | 378 BrowserNavigatorWebContentsAdoption::AttachTabHelpers(target_contents); |
383 #if defined(ENABLE_EXTENSIONS) | 379 #if defined(ENABLE_EXTENSIONS) |
384 extensions::TabHelper::FromWebContents(target_contents)-> | 380 extensions::TabHelper::FromWebContents(target_contents)-> |
385 SetExtensionAppById(params.extension_app_id); | 381 SetExtensionAppById(params.extension_app_id); |
386 #endif | 382 #endif |
387 | 383 |
388 #if !defined(OS_ANDROID) | |
389 FirstWebContentsProfiler::WebContentsStarted(target_contents); | |
390 #endif // !defined(OS_ANDROID) | |
391 return target_contents; | 384 return target_contents; |
392 } | 385 } |
393 | 386 |
394 // If a prerendered page exists for |url|, replace the page at | 387 // If a prerendered page exists for |url|, replace the page at |
395 // |params->target_contents| with it and update to point to the swapped-in | 388 // |params->target_contents| with it and update to point to the swapped-in |
396 // WebContents. | 389 // WebContents. |
397 bool SwapInPrerender(const GURL& url, chrome::NavigateParams* params) { | 390 bool SwapInPrerender(const GURL& url, chrome::NavigateParams* params) { |
398 Profile* profile = | 391 Profile* profile = |
399 Profile::FromBrowserContext(params->target_contents->GetBrowserContext()); | 392 Profile::FromBrowserContext(params->target_contents->GetBrowserContext()); |
400 InstantSearchPrerenderer* prerenderer = | 393 InstantSearchPrerenderer* prerenderer = |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 bool reverse_on_redirect = false; | 667 bool reverse_on_redirect = false; |
675 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 668 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
676 &rewritten_url, browser_context, &reverse_on_redirect); | 669 &rewritten_url, browser_context, &reverse_on_redirect); |
677 | 670 |
678 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 671 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
679 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 672 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
680 rewritten_url.host() == chrome::kChromeUIUberHost); | 673 rewritten_url.host() == chrome::kChromeUIUberHost); |
681 } | 674 } |
682 | 675 |
683 } // namespace chrome | 676 } // namespace chrome |
OLD | NEW |