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

Side by Side Diff: chrome/browser/ui/webui/uber/uber_ui.cc

Issue 313363004: Separate Settings and Help from History and Extensions when settings-in- (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (no conflicts) Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/settings_window_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/uber/uber_ui.h" 5 #include "chrome/browser/ui/webui/uber/uber_ui.h"
6 6
7 #include "base/command_line.h"
7 #include "base/stl_util.h" 8 #include "base/stl_util.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.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"
16 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/extensions/manifest_url_handler.h" 17 #include "chrome/common/extensions/manifest_url_handler.h"
16 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
17 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
20 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_ui.h" 23 #include "content/public/browser/web_ui.h"
22 #include "content/public/browser/web_ui_data_source.h" 24 #include "content/public/browser/web_ui_data_source.h"
23 #include "extensions/common/extension_set.h" 25 #include "extensions/common/extension_set.h"
24 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
25 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
26 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
27 29
28 using base::ASCIIToUTF16; 30 using base::ASCIIToUTF16;
29 using content::NavigationController; 31 using content::NavigationController;
30 using content::NavigationEntry; 32 using content::NavigationEntry;
31 using content::RenderViewHost; 33 using content::RenderViewHost;
32 using content::WebContents; 34 using content::WebContents;
33 35
34 namespace { 36 namespace {
35 37
38 bool IsSettingsWindowEnabled() {
39 return CommandLine::ForCurrentProcess()->HasSwitch(
40 ::switches::kEnableSettingsWindow);
41 }
42
36 content::WebUIDataSource* CreateUberHTMLSource() { 43 content::WebUIDataSource* CreateUberHTMLSource() {
37 content::WebUIDataSource* source = 44 content::WebUIDataSource* source =
38 content::WebUIDataSource::Create(chrome::kChromeUIUberHost); 45 content::WebUIDataSource::Create(chrome::kChromeUIUberHost);
39 46
40 source->SetUseJsonJSFormatV2(); 47 source->SetUseJsonJSFormatV2();
41 source->SetJsonPath("strings.js"); 48 source->SetJsonPath("strings.js");
42 source->AddResourcePath("uber.js", IDR_UBER_JS); 49 source->AddResourcePath("uber.js", IDR_UBER_JS);
43 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS); 50 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS);
44 source->SetDefaultResource(IDR_UBER_HTML); 51 source->SetDefaultResource(IDR_UBER_HTML);
45 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); 52 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS); 102 source->AddResourcePath("uber_frame.js", IDR_UBER_FRAME_JS);
96 source->SetDefaultResource(IDR_UBER_FRAME_HTML); 103 source->SetDefaultResource(IDR_UBER_FRAME_HTML);
97 104
98 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME. 105 // TODO(jhawkins): Attempt to get rid of IDS_SHORT_PRODUCT_OS_NAME.
99 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
100 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME); 107 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_OS_NAME);
101 #else 108 #else
102 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); 109 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME);
103 #endif // defined(OS_CHROMEOS) 110 #endif // defined(OS_CHROMEOS)
104 111
112 // Group settings and help separately if settings in a window is enabled.
113 base::string16 settings_group(ASCIIToUTF16("settings_group"));
114 base::string16 other_group(ASCIIToUTF16(
115 IsSettingsWindowEnabled() ? "other_group" : "settings_group"));
105 source->AddString("extensionsHost", 116 source->AddString("extensionsHost",
106 ASCIIToUTF16(chrome::kChromeUIExtensionsHost)); 117 ASCIIToUTF16(chrome::kChromeUIExtensionsHost));
107 source->AddLocalizedString("extensionsDisplayName", 118 source->AddLocalizedString("extensionsDisplayName",
108 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); 119 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);
120 source->AddString("extensionsGroup", other_group);
109 source->AddString("helpHost", 121 source->AddString("helpHost",
110 ASCIIToUTF16(chrome::kChromeUIHelpHost)); 122 ASCIIToUTF16(chrome::kChromeUIHelpHost));
111 source->AddLocalizedString("helpDisplayName", IDS_ABOUT_TITLE); 123 source->AddLocalizedString("helpDisplayName", IDS_ABOUT_TITLE);
124 source->AddString("helpGroup", settings_group);
112 source->AddString("historyHost", 125 source->AddString("historyHost",
113 ASCIIToUTF16(chrome::kChromeUIHistoryHost)); 126 ASCIIToUTF16(chrome::kChromeUIHistoryHost));
114 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE); 127 source->AddLocalizedString("historyDisplayName", IDS_HISTORY_TITLE);
128 source->AddString("historyGroup", other_group);
115 source->AddString("settingsHost", 129 source->AddString("settingsHost",
116 ASCIIToUTF16(chrome::kChromeUISettingsHost)); 130 ASCIIToUTF16(chrome::kChromeUISettingsHost));
117 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE); 131 source->AddLocalizedString("settingsDisplayName", IDS_SETTINGS_TITLE);
132 source->AddString("settingsGroup", settings_group);
118 bool overridesHistory = HasExtensionType(profile, 133 bool overridesHistory = HasExtensionType(profile,
119 chrome::kChromeUIHistoryHost); 134 chrome::kChromeUIHistoryHost);
120 source->AddString("overridesHistory", 135 source->AddString("overridesHistory",
121 ASCIIToUTF16(overridesHistory ? "yes" : "no")); 136 ASCIIToUTF16(overridesHistory ? "yes" : "no"));
122 source->DisableDenyXFrameOptions(); 137 source->DisableDenyXFrameOptions();
123 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); 138 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;");
124 139
125 return source; 140 return source;
126 } 141 }
127 142
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 web_ui()->CallJavascriptFunction( 244 web_ui()->CallJavascriptFunction(
230 "uber_frame.setNavigationOverride", 245 "uber_frame.setNavigationOverride",
231 base::StringValue(chrome::kChromeUIHistoryHost), 246 base::StringValue(chrome::kChromeUIHistoryHost),
232 base::StringValue(overrides_history ? "yes" : "no")); 247 base::StringValue(overrides_history ? "yes" : "no"));
233 break; 248 break;
234 } 249 }
235 default: 250 default:
236 NOTREACHED(); 251 NOTREACHED();
237 } 252 }
238 } 253 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/settings_window_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698