| 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" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_about_handler.h" | 13 #include "chrome/browser/browser_about_handler.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/tab_helper.h" | 16 #include "chrome/browser/extensions/tab_helper.h" |
| 17 #include "chrome/browser/google/google_url_tracker.h" | 17 #include "chrome/browser/google/google_url_tracker.h" |
| 18 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 18 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 19 #include "chrome/browser/prerender/prerender_manager.h" | 19 #include "chrome/browser/prerender/prerender_manager.h" |
| 20 #include "chrome/browser/prerender/prerender_manager_factory.h" | 20 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 21 #include "chrome/browser/prerender/prerender_util.h" | 21 #include "chrome/browser/prerender/prerender_util.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/tab_contents/tab_util.h" | 23 #include "chrome/browser/tab_contents/tab_util.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
| 26 #include "chrome/browser/ui/browser_instant_controller.h" | 26 #include "chrome/browser/ui/browser_instant_controller.h" |
| 27 #include "chrome/browser/ui/browser_tab_contents.h" | |
| 28 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/host_desktop.h" | 28 #include "chrome/browser/ui/host_desktop.h" |
| 30 #include "chrome/browser/ui/omnibox/location_bar.h" | 29 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 31 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 30 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 32 #include "chrome/browser/ui/singleton_tabs.h" | 31 #include "chrome/browser/ui/singleton_tabs.h" |
| 33 #include "chrome/browser/ui/status_bubble.h" | 32 #include "chrome/browser/ui/status_bubble.h" |
| 33 #include "chrome/browser/ui/tab_helpers.h" |
| 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 35 #include "chrome/browser/web_applications/web_app.h" | 35 #include "chrome/browser/web_applications/web_app.h" |
| 36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "content/public/browser/browser_url_handler.h" | 38 #include "content/public/browser/browser_url_handler.h" |
| 39 #include "content/public/browser/navigation_entry.h" | 39 #include "content/public/browser/navigation_entry.h" |
| 40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
| 42 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
| 43 #include "content/public/browser/web_contents_view.h" | 43 #include "content/public/browser/web_contents_view.h" |
| 44 #include "extensions/common/extension.h" | 44 #include "extensions/common/extension.h" |
| 45 | 45 |
| 46 #if defined(USE_ASH) | 46 #if defined(USE_ASH) |
| 47 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 47 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 48 #endif | 48 #endif |
| 49 #if defined(USE_AURA) | 49 #if defined(USE_AURA) |
| 50 #include "ui/aura/window.h" | 50 #include "ui/aura/window.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 using content::GlobalRequestID; | 53 using content::GlobalRequestID; |
| 54 using content::NavigationController; | 54 using content::NavigationController; |
| 55 using content::WebContents; | 55 using content::WebContents; |
| 56 | 56 |
| 57 class BrowserNavigatorWebContentsAdoption { | 57 class BrowserNavigatorWebContentsAdoption { |
| 58 public: | 58 public: |
| 59 static void AttachTabHelpers(content::WebContents* contents) { | 59 static void AttachTabHelpers(content::WebContents* contents) { |
| 60 BrowserTabContents::AttachTabHelpers(contents); | 60 TabHelpers::AttachTabHelpers(contents); |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| 66 // Returns true if the specified Browser can open tabs. Not all Browsers support | 66 // Returns true if the specified Browser can open tabs. Not all Browsers support |
| 67 // multiple tabs, such as app frames and popups. This function returns false for | 67 // multiple tabs, such as app frames and popups. This function returns false for |
| 68 // those types of Browser. | 68 // those types of Browser. |
| 69 bool WindowCanOpenTabs(Browser* browser) { | 69 bool WindowCanOpenTabs(Browser* browser) { |
| 70 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || | 70 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) || |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 bool reverse_on_redirect = false; | 752 bool reverse_on_redirect = false; |
| 753 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 753 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 754 &rewritten_url, browser_context, &reverse_on_redirect); | 754 &rewritten_url, browser_context, &reverse_on_redirect); |
| 755 | 755 |
| 756 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 756 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 757 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && | 757 return !(rewritten_url.scheme() == chrome::kChromeUIScheme && |
| 758 rewritten_url.host() == chrome::kChromeUIUberHost); | 758 rewritten_url.host() == chrome::kChromeUIUberHost); |
| 759 } | 759 } |
| 760 | 760 |
| 761 } // namespace chrome | 761 } // namespace chrome |
| OLD | NEW |