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

Side by Side Diff: chrome/browser/dom_ui/labs_ui.cc

Issue 3817004: Rename about:labs to about:flags, step 1/3 (Closed)
Patch Set: Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/labs_ui.h" 5 #include "chrome/browser/dom_ui/labs_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 18 matching lines...) Expand all
29 29
30 /////////////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////////////
31 // 31 //
32 // LabsUIHTMLSource 32 // LabsUIHTMLSource
33 // 33 //
34 /////////////////////////////////////////////////////////////////////////////// 34 ///////////////////////////////////////////////////////////////////////////////
35 35
36 class LabsUIHTMLSource : public ChromeURLDataManager::DataSource { 36 class LabsUIHTMLSource : public ChromeURLDataManager::DataSource {
37 public: 37 public:
38 LabsUIHTMLSource() 38 LabsUIHTMLSource()
39 : DataSource(chrome::kChromeUILabsHost, MessageLoop::current()) {} 39 : DataSource(chrome::kChromeUIFlagsHost, MessageLoop::current()) {}
40 40
41 // Called when the network layer has requested a resource underneath 41 // Called when the network layer has requested a resource underneath
42 // the path we registered. 42 // the path we registered.
43 virtual void StartDataRequest(const std::string& path, 43 virtual void StartDataRequest(const std::string& path,
44 bool is_off_the_record, 44 bool is_off_the_record,
45 int request_id); 45 int request_id);
46 virtual std::string GetMimeType(const std::string&) const { 46 virtual std::string GetMimeType(const std::string&) const {
47 return "text/html"; 47 return "text/html";
48 } 48 }
49 49
50 private: 50 private:
51 ~LabsUIHTMLSource() {} 51 ~LabsUIHTMLSource() {}
52 52
53 DISALLOW_COPY_AND_ASSIGN(LabsUIHTMLSource); 53 DISALLOW_COPY_AND_ASSIGN(LabsUIHTMLSource);
54 }; 54 };
55 55
56 void LabsUIHTMLSource::StartDataRequest(const std::string& path, 56 void LabsUIHTMLSource::StartDataRequest(const std::string& path,
57 bool is_off_the_record, 57 bool is_off_the_record,
58 int request_id) { 58 int request_id) {
59 // Strings used in the JsTemplate file. 59 // Strings used in the JsTemplate file.
60 DictionaryValue localized_strings; 60 DictionaryValue localized_strings;
61 localized_strings.SetString("labsTitle", 61 localized_strings.SetString("labsTitle",
62 l10n_util::GetStringUTF16(IDS_LABS_TITLE)); 62 l10n_util::GetStringUTF16(IDS_FLAGS_TITLE));
63 localized_strings.SetString("labsLongTitle", 63 localized_strings.SetString("labsLongTitle",
64 l10n_util::GetStringUTF16(IDS_LABS_LONG_TITLE)); 64 l10n_util::GetStringUTF16(IDS_FLAGS_LONG_TITLE));
65 localized_strings.SetString("labsTableTitle", 65 localized_strings.SetString("labsTableTitle",
66 l10n_util::GetStringUTF16(IDS_LABS_TABLE_TITLE)); 66 l10n_util::GetStringUTF16(IDS_FLAGS_TABLE_TITLE));
67 localized_strings.SetString("labsNoExperimentsAvailable", 67 localized_strings.SetString("labsNoExperimentsAvailable",
68 l10n_util::GetStringUTF16(IDS_LABS_NO_EXPERIMENTS_AVAILABLE)); 68 l10n_util::GetStringUTF16(IDS_FLAGS_NO_EXPERIMENTS_AVAILABLE));
69 localized_strings.SetString("flagsWarningHeader", l10n_util::GetStringUTF16(
70 IDS_FLAGS_WARNING_HEADER));
69 localized_strings.SetString("labsBlurb", l10n_util::GetStringFUTF16( 71 localized_strings.SetString("labsBlurb", l10n_util::GetStringFUTF16(
70 IDS_LABS_BLURB, 72 IDS_FLAGS_WARNING_TEXT,
71 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 73 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
72 localized_strings.SetString("labsRestartNotice", l10n_util::GetStringFUTF16( 74 localized_strings.SetString("labsRestartNotice", l10n_util::GetStringFUTF16(
73 IDS_LABS_RESTART_NOTICE, 75 IDS_FLAGS_RESTART_NOTICE,
74 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 76 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
75 localized_strings.SetString("labsRestartButton", 77 localized_strings.SetString("labsRestartButton",
76 l10n_util::GetStringUTF16(IDS_LABS_RESTART_BUTTON)); 78 l10n_util::GetStringUTF16(IDS_FLAGS_RESTART_BUTTON));
77 localized_strings.SetString("disable", 79 localized_strings.SetString("disable",
78 l10n_util::GetStringUTF16(IDS_LABS_DISABLE)); 80 l10n_util::GetStringUTF16(IDS_FLAGS_DISABLE));
79 localized_strings.SetString("enable", 81 localized_strings.SetString("enable",
80 l10n_util::GetStringUTF16(IDS_LABS_ENABLE)); 82 l10n_util::GetStringUTF16(IDS_FLAGS_ENABLE));
81 83
82 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 84 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
83 85
84 static const base::StringPiece labs_html( 86 static const base::StringPiece labs_html(
85 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_LABS_HTML)); 87 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_LABS_HTML));
86 std::string full_html(labs_html.data(), labs_html.size()); 88 std::string full_html(labs_html.data(), labs_html.size());
87 jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html); 89 jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html);
88 jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html); 90 jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html);
89 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); 91 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html);
90 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); 92 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // static 193 // static
192 RefCountedMemory* LabsUI::GetFaviconResourceBytes() { 194 RefCountedMemory* LabsUI::GetFaviconResourceBytes() {
193 return ResourceBundle::GetSharedInstance(). 195 return ResourceBundle::GetSharedInstance().
194 LoadDataResourceBytes(IDR_LABS); 196 LoadDataResourceBytes(IDR_LABS);
195 } 197 }
196 198
197 // static 199 // static
198 void LabsUI::RegisterUserPrefs(PrefService* prefs) { 200 void LabsUI::RegisterUserPrefs(PrefService* prefs) {
199 prefs->RegisterListPref(prefs::kEnabledLabsExperiments); 201 prefs->RegisterListPref(prefs::kEnabledLabsExperiments);
200 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698