Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 2759333002: Move chrome-specific SerializedNavigation code to chrome/. (Closed)
Patch Set: Fix Android Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/public/common/content_features.h"
24 #include "content/public/common/url_constants.h"
25 #include "extensions/features/features.h" 24 #include "extensions/features/features.h"
26 25
27 #if !defined(OS_ANDROID) 26 #if !defined(OS_ANDROID)
28 #include "chrome/browser/ui/webui/md_history_ui.h" 27 #include "chrome/browser/ui/webui/md_history_ui.h"
29 #endif 28 #endif
30 29
31 #if defined(OS_ANDROID) 30 #if defined(OS_ANDROID)
32 #include "chrome/browser/android/chrome_feature_list.h" 31 #include "chrome/browser/android/chrome_feature_list.h"
33 #endif 32 #endif
34 33
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 path = chrome::kChromeUIExtensionsHost + url->path(); 79 path = chrome::kChromeUIExtensionsHost + url->path();
81 } 80 }
82 // Redirect chrome://settings/extensions (legacy URL). 81 // Redirect chrome://settings/extensions (legacy URL).
83 } else if (host == chrome::kChromeUISettingsHost && 82 } else if (host == chrome::kChromeUISettingsHost &&
84 url->path() == 83 url->path() ==
85 std::string("/") + chrome::kDeprecatedExtensionsSubPage) { 84 std::string("/") + chrome::kDeprecatedExtensionsSubPage) {
86 host = chrome::kChromeUIUberHost; 85 host = chrome::kChromeUIUberHost;
87 path = chrome::kChromeUIExtensionsHost; 86 path = chrome::kChromeUIExtensionsHost;
88 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 87 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
89 // Redirect chrome://history. 88 // Redirect chrome://history.
90 } else if (host == content::kChromeUIHistoryHost) { 89 } else if (host == chrome::kChromeUIHistoryHost) {
91 #if defined(OS_ANDROID) 90 #if defined(OS_ANDROID)
92 // TODO(twellington): remove this after native Android history launches. 91 // TODO(twellington): remove this after native Android history launches.
93 // See http://crbug.com/654071. 92 // See http://crbug.com/654071.
94 if (!base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager)) { 93 if (!base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager)) {
95 // On Android, redirect directly to chrome://history-frame since 94 // On Android, redirect directly to chrome://history-frame since
96 // uber page is unsupported. 95 // uber page is unsupported.
97 host = chrome::kChromeUIHistoryFrameHost; 96 host = chrome::kChromeUIHistoryFrameHost;
98 } 97 }
99 #else 98 #else
100 // Material design history is handled on the top-level chrome://history 99 // Material design history is handled on the top-level chrome://history
101 // host. 100 // host.
102 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistory)) { 101 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistory)) {
103 host = content::kChromeUIHistoryHost; 102 host = chrome::kChromeUIHistoryHost;
104 path = url->path(); 103 path = url->path();
105 } else { 104 } else {
106 host = chrome::kChromeUIUberHost; 105 host = chrome::kChromeUIUberHost;
107 path = content::kChromeUIHistoryHost + url->path(); 106 path = chrome::kChromeUIHistoryHost + url->path();
108 } 107 }
109 #endif 108 #endif
110 // Redirect chrome://settings, unless MD settings is enabled. 109 // Redirect chrome://settings, unless MD settings is enabled.
111 } else if (host == chrome::kChromeUISettingsHost) { 110 } else if (host == chrome::kChromeUISettingsHost) {
112 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { 111 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
113 return true; // Prevent further rewriting - this is a valid URL. 112 return true; // Prevent further rewriting - this is a valid URL.
114 } else if (::switches::SettingsWindowEnabled()) { 113 } else if (::switches::SettingsWindowEnabled()) {
115 host = chrome::kChromeUISettingsFrameHost; 114 host = chrome::kChromeUISettingsFrameHost;
116 } else { 115 } else {
117 host = chrome::kChromeUIUberHost; 116 host = chrome::kChromeUIUberHost;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 FROM_HERE, base::Bind(&chrome::AttemptRestart)); 150 FROM_HERE, base::Bind(&chrome::AttemptRestart));
152 return true; 151 return true;
153 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { 152 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
154 base::ThreadTaskRunnerHandle::Get()->PostTask( 153 base::ThreadTaskRunnerHandle::Get()->PostTask(
155 FROM_HERE, base::Bind(&chrome::AttemptExit)); 154 FROM_HERE, base::Bind(&chrome::AttemptExit));
156 return true; 155 return true;
157 } 156 }
158 157
159 return false; 158 return false;
160 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/android/ntp/new_tab_page_url_handler.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698