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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } else if (path == kOptionsBundleJsFile) { | 155 } else if (path == kOptionsBundleJsFile) { |
156 // Return (and cache) the options javascript code. | 156 // Return (and cache) the options javascript code. |
157 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 157 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
158 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); | 158 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS); |
159 } else { | 159 } else { |
160 // Return (and cache) the main options html page as the default. | 160 // Return (and cache) the main options html page as the default. |
161 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 161 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
162 LoadDataResourceBytes(IDR_OPTIONS_HTML); | 162 LoadDataResourceBytes(IDR_OPTIONS_HTML); |
163 } | 163 } |
164 | 164 |
165 callback.Run(response_bytes); | 165 callback.Run(response_bytes.get()); |
166 } | 166 } |
167 | 167 |
168 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { | 168 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { |
169 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) | 169 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) |
170 return "application/javascript"; | 170 return "application/javascript"; |
171 | 171 |
172 return "text/html"; | 172 return "text/html"; |
173 } | 173 } |
174 | 174 |
175 bool OptionsUIHTMLSource::ShouldDenyXFrameOptions() const { | 175 bool OptionsUIHTMLSource::ShouldDenyXFrameOptions() const { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // Add only if handler's service is enabled. | 424 // Add only if handler's service is enabled. |
425 if (handler->IsEnabled()) { | 425 if (handler->IsEnabled()) { |
426 // Add handler to the list and also pass the ownership. | 426 // Add handler to the list and also pass the ownership. |
427 web_ui()->AddMessageHandler(handler.release()); | 427 web_ui()->AddMessageHandler(handler.release()); |
428 handler_raw->GetLocalizedValues(localized_strings); | 428 handler_raw->GetLocalizedValues(localized_strings); |
429 handlers_.push_back(handler_raw); | 429 handlers_.push_back(handler_raw); |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 } // namespace options | 433 } // namespace options |
OLD | NEW |