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/options/options_ui.h" | 5 #include "chrome/browser/ui/webui/options/options_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 std::string OptionsUIHTMLSource::GetSource() const { | 160 std::string OptionsUIHTMLSource::GetSource() const { |
161 return chrome::kChromeUISettingsFrameHost; | 161 return chrome::kChromeUISettingsFrameHost; |
162 } | 162 } |
163 | 163 |
164 void OptionsUIHTMLSource::StartDataRequest( | 164 void OptionsUIHTMLSource::StartDataRequest( |
165 const std::string& path, | 165 const std::string& path, |
166 int render_process_id, | 166 int render_process_id, |
167 int render_frame_id, | 167 int render_frame_id, |
168 const content::URLDataSource::GotDataCallback& callback) { | 168 const content::URLDataSource::GotDataCallback& callback) { |
169 scoped_refptr<base::RefCountedMemory> response_bytes; | 169 scoped_refptr<base::RefCountedMemory> response_bytes; |
170 webui::SetFontAndTextDirection(localized_strings_.get()); | 170 webui::SetTextDirection(localized_strings_.get()); |
171 | 171 |
172 if (path == kLocalizedStringsFile) { | 172 if (path == kLocalizedStringsFile) { |
173 // Return dynamically-generated strings from memory. | 173 // Return dynamically-generated strings from memory. |
174 std::string strings_js; | 174 std::string strings_js; |
175 webui::AppendJsonJS(localized_strings_.get(), &strings_js); | 175 webui::AppendJsonJS(localized_strings_.get(), &strings_js); |
176 response_bytes = base::RefCountedString::TakeString(&strings_js); | 176 response_bytes = base::RefCountedString::TakeString(&strings_js); |
177 } else if (path == kOptionsBundleJsFile) { | 177 } else if (path == kOptionsBundleJsFile) { |
178 // Return (and cache) the options javascript code. | 178 // Return (and cache) the options javascript code. |
179 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 179 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
180 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); | 180 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Add only if handler's service is enabled. | 482 // Add only if handler's service is enabled. |
483 if (handler->IsEnabled()) { | 483 if (handler->IsEnabled()) { |
484 // Add handler to the list and also pass the ownership. | 484 // Add handler to the list and also pass the ownership. |
485 web_ui()->AddMessageHandler(handler.release()); | 485 web_ui()->AddMessageHandler(handler.release()); |
486 handler_raw->GetLocalizedValues(localized_strings); | 486 handler_raw->GetLocalizedValues(localized_strings); |
487 handlers_.push_back(handler_raw); | 487 handlers_.push_back(handler_raw); |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 } // namespace options | 491 } // namespace options |
OLD | NEW |