| 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/options2/options_ui2.h" | 5 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 void OptionsUIHTMLSource::StartDataRequest(const std::string& path, | 137 void OptionsUIHTMLSource::StartDataRequest(const std::string& path, |
| 138 bool is_incognito, | 138 bool is_incognito, |
| 139 int request_id) { | 139 int request_id) { |
| 140 scoped_refptr<base::RefCountedMemory> response_bytes; | 140 scoped_refptr<base::RefCountedMemory> response_bytes; |
| 141 SetFontAndTextDirection(localized_strings_.get()); | 141 SetFontAndTextDirection(localized_strings_.get()); |
| 142 | 142 |
| 143 if (path == kLocalizedStringsFile) { | 143 if (path == kLocalizedStringsFile) { |
| 144 // Return dynamically-generated strings from memory. | 144 // Return dynamically-generated strings from memory. |
| 145 jstemplate_builder::UseVersion2 version; |
| 145 std::string strings_js; | 146 std::string strings_js; |
| 146 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); | 147 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); |
| 147 response_bytes = base::RefCountedString::TakeString(&strings_js); | 148 response_bytes = base::RefCountedString::TakeString(&strings_js); |
| 148 } else if (path == kOptionsBundleJsFile) { | 149 } else if (path == kOptionsBundleJsFile) { |
| 149 // Return (and cache) the options javascript code. | 150 // Return (and cache) the options javascript code. |
| 150 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 151 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 151 IDR_OPTIONS2_BUNDLE_JS); | 152 IDR_OPTIONS2_BUNDLE_JS); |
| 152 } else { | 153 } else { |
| 153 // Return (and cache) the main options html page as the default. | 154 // Return (and cache) the main options html page as the default. |
| 154 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 155 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // Add only if handler's service is enabled. | 391 // Add only if handler's service is enabled. |
| 391 if (handler->IsEnabled()) { | 392 if (handler->IsEnabled()) { |
| 392 // Add handler to the list and also pass the ownership. | 393 // Add handler to the list and also pass the ownership. |
| 393 web_ui()->AddMessageHandler(handler.release()); | 394 web_ui()->AddMessageHandler(handler.release()); |
| 394 handler_raw->GetLocalizedValues(localized_strings); | 395 handler_raw->GetLocalizedValues(localized_strings); |
| 395 handlers_.push_back(handler_raw); | 396 handlers_.push_back(handler_raw); |
| 396 } | 397 } |
| 397 } | 398 } |
| 398 | 399 |
| 399 } // namespace options2 | 400 } // namespace options2 |
| OLD | NEW |