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/webui/uber/uber_ui.h" | 5 #include "chrome/browser/ui/webui/uber/uber_ui.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
11 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 11 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
12 #include "chrome/browser/ui/webui/log_web_ui_url.h" | 12 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
13 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 14 #include "chrome/common/chrome_features.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 16 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "chrome/grit/chromium_strings.h" | 18 #include "chrome/grit/chromium_strings.h" |
18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
19 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
20 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
21 #include "content/public/browser/navigation_controller.h" | 22 #include "content/public/browser/navigation_controller.h" |
22 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); | 102 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); |
102 source->AddString("helpHost", chrome::kChromeUIHelpHost); | 103 source->AddString("helpHost", chrome::kChromeUIHelpHost); |
103 source->AddLocalizedString("helpDisplayName", IDS_ABOUT_TITLE); | 104 source->AddLocalizedString("helpDisplayName", IDS_ABOUT_TITLE); |
104 source->AddString("historyHost", chrome::kChromeUIHistoryHost); | 105 source->AddString("historyHost", chrome::kChromeUIHistoryHost); |
105 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE); | 106 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE); |
106 source->AddString("settingsHost", chrome::kChromeUISettingsHost); | 107 source->AddString("settingsHost", chrome::kChromeUISettingsHost); |
107 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); | 108 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); |
108 bool overrides_history = | 109 bool overrides_history = |
109 HasExtensionType(browser_context, chrome::kChromeUIHistoryHost); | 110 HasExtensionType(browser_context, chrome::kChromeUIHistoryHost); |
110 source->AddString("overridesHistory", overrides_history ? "yes" : "no"); | 111 source->AddString("overridesHistory", overrides_history ? "yes" : "no"); |
111 source->AddBoolean("hideHistory", | 112 source->AddBoolean( |
112 ::switches::MdHistoryEnabled() && !overrides_history); | 113 "hideHistory", |
| 114 base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature) |
| 115 && !overrides_history); |
| 116 |
113 source->DisableDenyXFrameOptions(); | 117 source->DisableDenyXFrameOptions(); |
114 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); | 118 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); |
115 | 119 |
116 source->AddBoolean("profileIsGuest", | 120 source->AddBoolean("profileIsGuest", |
117 Profile::FromBrowserContext(browser_context)->IsGuestSession()); | 121 Profile::FromBrowserContext(browser_context)->IsGuestSession()); |
118 | 122 |
119 return source; | 123 return source; |
120 } | 124 } |
121 | 125 |
122 void UpdateHistoryNavigation(content::WebUI* web_ui) { | 126 void UpdateHistoryNavigation(content::WebUI* web_ui) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // opens the default history page if one is uninstalled or disabled. | 248 // opens the default history page if one is uninstalled or disabled. |
245 UpdateHistoryNavigation(web_ui()); | 249 UpdateHistoryNavigation(web_ui()); |
246 } | 250 } |
247 | 251 |
248 void UberFrameUI::OnExtensionUnloaded( | 252 void UberFrameUI::OnExtensionUnloaded( |
249 content::BrowserContext* browser_context, | 253 content::BrowserContext* browser_context, |
250 const extensions::Extension* extension, | 254 const extensions::Extension* extension, |
251 extensions::UnloadedExtensionInfo::Reason reason) { | 255 extensions::UnloadedExtensionInfo::Reason reason) { |
252 UpdateHistoryNavigation(web_ui()); | 256 UpdateHistoryNavigation(web_ui()); |
253 } | 257 } |
OLD | NEW |