| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 OptionsPageUIHandler::OptionsPageUIHandler() { | 164 OptionsPageUIHandler::OptionsPageUIHandler() { |
| 165 } | 165 } |
| 166 | 166 |
| 167 OptionsPageUIHandler::~OptionsPageUIHandler() { | 167 OptionsPageUIHandler::~OptionsPageUIHandler() { |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool OptionsPageUIHandler::IsEnabled() { | 170 bool OptionsPageUIHandler::IsEnabled() { |
| 171 return true; | 171 return true; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void OptionsPageUIHandler::UserMetricsRecordAction( | |
| 175 const UserMetricsAction& action) { | |
| 176 UserMetrics::RecordAction(action); | |
| 177 } | |
| 178 | |
| 179 // static | 174 // static |
| 180 void OptionsPageUIHandler::RegisterStrings( | 175 void OptionsPageUIHandler::RegisterStrings( |
| 181 DictionaryValue* localized_strings, | 176 DictionaryValue* localized_strings, |
| 182 const OptionsStringResource* resources, | 177 const OptionsStringResource* resources, |
| 183 size_t length) { | 178 size_t length) { |
| 184 for (size_t i = 0; i < length; ++i) { | 179 for (size_t i = 0; i < length; ++i) { |
| 185 localized_strings->SetString( | 180 localized_strings->SetString( |
| 186 resources[i].name, l10n_util::GetStringUTF16(resources[i].id)); | 181 resources[i].name, l10n_util::GetStringUTF16(resources[i].id)); |
| 187 } | 182 } |
| 188 } | 183 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 OptionsPageUIHandler* handler_raw) { | 344 OptionsPageUIHandler* handler_raw) { |
| 350 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 345 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 351 DCHECK(handler.get()); | 346 DCHECK(handler.get()); |
| 352 // Add only if handler's service is enabled. | 347 // Add only if handler's service is enabled. |
| 353 if (handler->IsEnabled()) { | 348 if (handler->IsEnabled()) { |
| 354 handler->GetLocalizedValues(localized_strings); | 349 handler->GetLocalizedValues(localized_strings); |
| 355 // Add handler to the list and also pass the ownership. | 350 // Add handler to the list and also pass the ownership. |
| 356 AddMessageHandler(handler.release()->Attach(this)); | 351 AddMessageHandler(handler.release()->Attach(this)); |
| 357 } | 352 } |
| 358 } | 353 } |
| OLD | NEW |