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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 16 #include "chrome/browser/lifetime/application_lifetime.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser_dialogs.h" | 18 #include "chrome/browser/ui/browser_dialogs.h" |
19 #include "chrome/common/chrome_features.h" | 19 #include "chrome/common/chrome_features.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "components/url_formatter/url_fixer.h" | 22 #include "components/url_formatter/url_fixer.h" |
| 23 #include "content/public/common/content_features.h" |
23 #include "extensions/features/features.h" | 24 #include "extensions/features/features.h" |
24 | 25 |
25 #if !defined(OS_ANDROID) | 26 #if !defined(OS_ANDROID) |
26 #include "chrome/browser/ui/webui/md_history_ui.h" | 27 #include "chrome/browser/ui/webui/md_history_ui.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
30 #include "chrome/browser/android/chrome_feature_list.h" | 31 #include "chrome/browser/android/chrome_feature_list.h" |
31 #endif | 32 #endif |
32 | 33 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } else if (host == chrome::kChromeUISettingsHost && | 82 } else if (host == chrome::kChromeUISettingsHost && |
82 url->path() == std::string("/") + chrome::kExtensionsSubPage) { | 83 url->path() == std::string("/") + chrome::kExtensionsSubPage) { |
83 host = chrome::kChromeUIUberHost; | 84 host = chrome::kChromeUIUberHost; |
84 path = chrome::kChromeUIExtensionsHost; | 85 path = chrome::kChromeUIExtensionsHost; |
85 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 86 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
86 // Redirect chrome://history. | 87 // Redirect chrome://history. |
87 } else if (host == chrome::kChromeUIHistoryHost) { | 88 } else if (host == chrome::kChromeUIHistoryHost) { |
88 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
89 // TODO(twellington): remove this after native Android history launches. | 90 // TODO(twellington): remove this after native Android history launches. |
90 // See http://crbug.com/654071. | 91 // See http://crbug.com/654071. |
91 if (!base::FeatureList::IsEnabled( | 92 if (!base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager)) { |
92 chrome::android::kNativeAndroidHistoryManager)) { | |
93 // On Android, redirect directly to chrome://history-frame since | 93 // On Android, redirect directly to chrome://history-frame since |
94 // uber page is unsupported. | 94 // uber page is unsupported. |
95 host = chrome::kChromeUIHistoryFrameHost; | 95 host = chrome::kChromeUIHistoryFrameHost; |
96 } | 96 } |
97 #else | 97 #else |
98 // Material design history is handled on the top-level chrome://history | 98 // Material design history is handled on the top-level chrome://history |
99 // host. | 99 // host. |
100 if (MdHistoryUI::IsEnabled(Profile::FromBrowserContext(browser_context))) { | 100 if (MdHistoryUI::IsEnabled(Profile::FromBrowserContext(browser_context))) { |
101 host = chrome::kChromeUIHistoryHost; | 101 host = chrome::kChromeUIHistoryHost; |
102 path = url->path(); | 102 path = url->path(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 FROM_HERE, base::Bind(&chrome::AttemptRestart)); | 149 FROM_HERE, base::Bind(&chrome::AttemptRestart)); |
150 return true; | 150 return true; |
151 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 151 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
152 base::ThreadTaskRunnerHandle::Get()->PostTask( | 152 base::ThreadTaskRunnerHandle::Get()->PostTask( |
153 FROM_HERE, base::Bind(&chrome::AttemptExit)); | 153 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
154 return true; | 154 return true; |
155 } | 155 } |
156 | 156 |
157 return false; | 157 return false; |
158 } | 158 } |
OLD | NEW |