| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void OptionsUIHTMLSource::StartDataRequest( | 136 void OptionsUIHTMLSource::StartDataRequest( |
| 137 const std::string& path, | 137 const std::string& path, |
| 138 bool is_incognito, | 138 bool is_incognito, |
| 139 const content::URLDataSource::GotDataCallback& callback) { | 139 const content::URLDataSource::GotDataCallback& callback) { |
| 140 scoped_refptr<base::RefCountedMemory> response_bytes; | 140 scoped_refptr<base::RefCountedMemory> response_bytes; |
| 141 web_ui_util::SetFontAndTextDirection(localized_strings_.get()); | 141 web_ui_util::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 webui::UseVersion2 version; |
| 146 std::string strings_js; | 146 std::string strings_js; |
| 147 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); | 147 webui::AppendJsonJS(localized_strings_.get(), &strings_js); |
| 148 response_bytes = base::RefCountedString::TakeString(&strings_js); | 148 response_bytes = base::RefCountedString::TakeString(&strings_js); |
| 149 } else if (path == kOptionsBundleJsFile) { | 149 } else if (path == kOptionsBundleJsFile) { |
| 150 // Return (and cache) the options javascript code. | 150 // Return (and cache) the options javascript code. |
| 151 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 151 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
| 152 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); | 152 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); |
| 153 } else { | 153 } else { |
| 154 // Return (and cache) the main options html page as the default. | 154 // Return (and cache) the main options html page as the default. |
| 155 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 155 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
| 156 LoadDataResourceBytes(IDR_OPTIONS_HTML); | 156 LoadDataResourceBytes(IDR_OPTIONS_HTML); |
| 157 } | 157 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // Add only if handler's service is enabled. | 409 // Add only if handler's service is enabled. |
| 410 if (handler->IsEnabled()) { | 410 if (handler->IsEnabled()) { |
| 411 // Add handler to the list and also pass the ownership. | 411 // Add handler to the list and also pass the ownership. |
| 412 web_ui()->AddMessageHandler(handler.release()); | 412 web_ui()->AddMessageHandler(handler.release()); |
| 413 handler_raw->GetLocalizedValues(localized_strings); | 413 handler_raw->GetLocalizedValues(localized_strings); |
| 414 handlers_.push_back(handler_raw); | 414 handlers_.push_back(handler_raw); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace options | 418 } // namespace options |
| OLD | NEW |