| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void OptionsUIHTMLSource::StartDataRequest( | 154 void OptionsUIHTMLSource::StartDataRequest( |
| 155 const std::string& path, | 155 const std::string& path, |
| 156 int render_process_id, | 156 int render_process_id, |
| 157 int render_frame_id, | 157 int render_frame_id, |
| 158 const content::URLDataSource::GotDataCallback& callback) { | 158 const content::URLDataSource::GotDataCallback& callback) { |
| 159 scoped_refptr<base::RefCountedMemory> response_bytes; | 159 scoped_refptr<base::RefCountedMemory> response_bytes; |
| 160 webui::SetFontAndTextDirection(localized_strings_.get()); | 160 webui::SetFontAndTextDirection(localized_strings_.get()); |
| 161 | 161 |
| 162 if (path == kLocalizedStringsFile) { | 162 if (path == kLocalizedStringsFile) { |
| 163 // Return dynamically-generated strings from memory. | 163 // Return dynamically-generated strings from memory. |
| 164 webui::UseVersion2 version; | |
| 165 std::string strings_js; | 164 std::string strings_js; |
| 166 webui::AppendJsonJS(localized_strings_.get(), &strings_js); | 165 webui::AppendJsonJS(localized_strings_.get(), &strings_js); |
| 167 response_bytes = base::RefCountedString::TakeString(&strings_js); | 166 response_bytes = base::RefCountedString::TakeString(&strings_js); |
| 168 } else if (path == kOptionsBundleJsFile) { | 167 } else if (path == kOptionsBundleJsFile) { |
| 169 // Return (and cache) the options javascript code. | 168 // Return (and cache) the options javascript code. |
| 170 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 169 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
| 171 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); | 170 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); |
| 172 } else { | 171 } else { |
| 173 // Return (and cache) the main options html page as the default. | 172 // Return (and cache) the main options html page as the default. |
| 174 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 173 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Add only if handler's service is enabled. | 466 // Add only if handler's service is enabled. |
| 468 if (handler->IsEnabled()) { | 467 if (handler->IsEnabled()) { |
| 469 // Add handler to the list and also pass the ownership. | 468 // Add handler to the list and also pass the ownership. |
| 470 web_ui()->AddMessageHandler(handler.release()); | 469 web_ui()->AddMessageHandler(handler.release()); |
| 471 handler_raw->GetLocalizedValues(localized_strings); | 470 handler_raw->GetLocalizedValues(localized_strings); |
| 472 handlers_.push_back(handler_raw); | 471 handlers_.push_back(handler_raw); |
| 473 } | 472 } |
| 474 } | 473 } |
| 475 | 474 |
| 476 } // namespace options | 475 } // namespace options |
| OLD | NEW |