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 "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/settings_window_manager.h" | |
12 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
13 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 14 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
14 #include "chrome/browser/ui/webui/options/options_ui.h" | 15 #include "chrome/browser/ui/webui/options/options_ui.h" |
15 #include "chrome/common/extensions/manifest_url_handler.h" | 16 #include "chrome/common/extensions/manifest_url_handler.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
18 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_ui.h" | 22 #include "content/public/browser/web_ui.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS); | 96 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS); |
96 source->SetDefaultResource(IDR_UBER_FRAME_HTML); | 97 source->SetDefaultResource(IDR_UBER_FRAME_HTML); |
97 | 98 |
98 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME. | 99 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME. |
99 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
100 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME); | 101 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME); |
101 #else | 102 #else |
102 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); | 103 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); |
103 #endif // defined(OS_CHROMEOS) | 104 #endif // defined(OS_CHROMEOS) |
104 | 105 |
106 // Group settings and help separately if settings in a window is enabled. | |
107 base::string16 settingsGroup(ASCIIToUTF16("group1")); | |
108 base::string16 otherGroup(ASCIIToUTF16( | |
109 chrome::SettingsWindowEnabled() ? "group2" : "group1")); | |
stevenjb
2014/06/05 21:59:05
Maybe names these "settings_group" and "other_grou
michaelpg
2014/06/06 21:09:49
Done.
| |
110 | |
105 source->AddString("extensionsHost", | 111 source->AddString("extensionsHost", |
106 ASCIIToUTF16(chrome::kChromeUIExtensionsHost)); | 112 ASCIIToUTF16(chrome::kChromeUIExtensionsHost)); |
107 source->AddLocalizedString("extensionsDisplayName", | 113 source->AddLocalizedString("extensionsDisplayName", |
108 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); | 114 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); |
115 source->AddString("extensionsGroup", otherGroup); | |
109 source->AddString("helpHost", | 116 source->AddString("helpHost", |
110 ASCIIToUTF16(chrome::kChromeUIHelpHost)); | 117 ASCIIToUTF16(chrome::kChromeUIHelpHost)); |
111 source->AddLocalizedString("helpDisplayName", IDS_HELP_TITLE); | 118 source->AddLocalizedString("helpDisplayName", IDS_HELP_TITLE); |
119 source->AddString("helpGroup", settingsGroup); | |
112 source->AddString("historyHost", | 120 source->AddString("historyHost", |
113 ASCIIToUTF16(chrome::kChromeUIHistoryHost)); | 121 ASCIIToUTF16(chrome::kChromeUIHistoryHost)); |
114 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE); | 122 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE); |
123 source->AddString("historyGroup", otherGroup); | |
115 source->AddString("settingsHost", | 124 source->AddString("settingsHost", |
116 ASCIIToUTF16(chrome::kChromeUISettingsHost)); | 125 ASCIIToUTF16(chrome::kChromeUISettingsHost)); |
117 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); | 126 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); |
127 source->AddString("settingsGroup", settingsGroup); | |
118 bool overridesHistory = HasExtensionType(profile, | 128 bool overridesHistory = HasExtensionType(profile, |
119 chrome::kChromeUIHistoryHost); | 129 chrome::kChromeUIHistoryHost); |
120 source->AddString("overridesHistory", | 130 source->AddString("overridesHistory", |
121 ASCIIToUTF16(overridesHistory ? "yes" : "no")); | 131 ASCIIToUTF16(overridesHistory ? "yes" : "no")); |
122 source->DisableDenyXFrameOptions(); | 132 source->DisableDenyXFrameOptions(); |
123 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); | 133 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); |
124 | 134 |
125 return source; | 135 return source; |
126 } | 136 } |
127 | 137 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 web_ui()->CallJavascriptFunction( | 239 web_ui()->CallJavascriptFunction( |
230 "uber_frame.setNavigationOverride", | 240 "uber_frame.setNavigationOverride", |
231 base::StringValue(chrome::kChromeUIHistoryHost), | 241 base::StringValue(chrome::kChromeUIHistoryHost), |
232 base::StringValue(overrides_history ? "yes" : "no")); | 242 base::StringValue(overrides_history ? "yes" : "no")); |
233 break; | 243 break; |
234 } | 244 } |
235 default: | 245 default: |
236 NOTREACHED(); | 246 NOTREACHED(); |
237 } | 247 } |
238 } | 248 } |
OLD | NEW |