| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::string OptionsUIHTMLSource::GetSource() const { | 157 std::string OptionsUIHTMLSource::GetSource() const { |
| 158 return chrome::kChromeUISettingsFrameHost; | 158 return chrome::kChromeUISettingsFrameHost; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void OptionsUIHTMLSource::StartDataRequest( | 161 void OptionsUIHTMLSource::StartDataRequest( |
| 162 const std::string& path, | 162 const std::string& path, |
| 163 int render_process_id, | 163 int render_process_id, |
| 164 int render_frame_id, | 164 int render_frame_id, |
| 165 const content::URLDataSource::GotDataCallback& callback) { | 165 const content::URLDataSource::GotDataCallback& callback) { |
| 166 scoped_refptr<base::RefCountedMemory> response_bytes; | 166 scoped_refptr<base::RefCountedMemory> response_bytes; |
| 167 webui::SetFontAndTextDirection(localized_strings_.get()); | 167 webui::SetTextDirection(localized_strings_.get()); |
| 168 | 168 |
| 169 if (path == kLocalizedStringsFile) { | 169 if (path == kLocalizedStringsFile) { |
| 170 // Return dynamically-generated strings from memory. | 170 // Return dynamically-generated strings from memory. |
| 171 std::string strings_js; | 171 std::string strings_js; |
| 172 webui::AppendJsonJS(localized_strings_.get(), &strings_js); | 172 webui::AppendJsonJS(localized_strings_.get(), &strings_js); |
| 173 response_bytes = base::RefCountedString::TakeString(&strings_js); | 173 response_bytes = base::RefCountedString::TakeString(&strings_js); |
| 174 } else if (path == kOptionsBundleJsFile) { | 174 } else if (path == kOptionsBundleJsFile) { |
| 175 // Return (and cache) the options javascript code. | 175 // Return (and cache) the options javascript code. |
| 176 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 176 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
| 177 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); | 177 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // Add only if handler's service is enabled. | 477 // Add only if handler's service is enabled. |
| 478 if (handler->IsEnabled()) { | 478 if (handler->IsEnabled()) { |
| 479 // Add handler to the list and also pass the ownership. | 479 // Add handler to the list and also pass the ownership. |
| 480 web_ui()->AddMessageHandler(handler.release()); | 480 web_ui()->AddMessageHandler(handler.release()); |
| 481 handler_raw->GetLocalizedValues(localized_strings); | 481 handler_raw->GetLocalizedValues(localized_strings); |
| 482 handlers_.push_back(handler_raw); | 482 handlers_.push_back(handler_raw); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 } // namespace options | 486 } // namespace options |
| OLD | NEW |