| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/options_ui.h" | 5 #include "chrome/browser/dom_ui/options_ui.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 65 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 66 html_bytes->data.resize(full_html.size()); | 66 html_bytes->data.resize(full_html.size()); |
| 67 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 67 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
| 68 | 68 |
| 69 SendResponse(request_id, html_bytes); | 69 SendResponse(request_id, html_bytes); |
| 70 } | 70 } |
| 71 | 71 |
| 72 //////////////////////////////////////////////////////////////////////////////// | 72 //////////////////////////////////////////////////////////////////////////////// |
| 73 // | 73 // |
| 74 // OptionsUIHandler | 74 // OptionsPageUIHandler |
| 75 // | 75 // |
| 76 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
| 77 | 77 |
| 78 OptionsPageUIHandler::OptionsPageUIHandler() { | 78 OptionsPageUIHandler::OptionsPageUIHandler() { |
| 79 } | 79 } |
| 80 | 80 |
| 81 OptionsPageUIHandler::~OptionsPageUIHandler() { | 81 OptionsPageUIHandler::~OptionsPageUIHandler() { |
| 82 } | 82 } |
| 83 | 83 |
| 84 void OptionsPageUIHandler::UserMetricsRecordAction( | 84 void OptionsPageUIHandler::UserMetricsRecordAction( |
| 85 const UserMetricsAction& action, PrefService* prefs) { | 85 const UserMetricsAction& action, PrefService* prefs) { |
| 86 UserMetrics::RecordAction(action, dom_ui_->GetProfile()); | 86 UserMetrics::RecordAction(action, dom_ui_->GetProfile()); |
| 87 if (prefs) | 87 if (prefs) |
| 88 prefs->ScheduleSavePersistentPrefs(); | 88 prefs->ScheduleSavePersistentPrefs(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
| 92 // | 92 // |
| 93 // OptionsUIContents | 93 // OptionsUI |
| 94 // | 94 // |
| 95 //////////////////////////////////////////////////////////////////////////////// | 95 //////////////////////////////////////////////////////////////////////////////// |
| 96 | 96 |
| 97 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { | 97 OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) { |
| 98 DictionaryValue* localized_strings = new DictionaryValue(); | 98 DictionaryValue* localized_strings = new DictionaryValue(); |
| 99 | 99 |
| 100 // TODO(zelidrag): Add all other page handlers here as we implement them. | 100 // TODO(zelidrag): Add all other page handlers here as we implement them. |
| 101 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); | 101 AddOptionsPageUIHandler(localized_strings, new CoreOptionsHandler()); |
| 102 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
| 103 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); | 103 AddOptionsPageUIHandler(localized_strings, new SystemOptionsHandler()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 123 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON); | 123 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON); |
| 124 return NULL; | 124 return NULL; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 127 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 128 OptionsPageUIHandler* handler) { | 128 OptionsPageUIHandler* handler) { |
| 129 DCHECK(handler); | 129 DCHECK(handler); |
| 130 handler->GetLocalizedValues(localized_strings); | 130 handler->GetLocalizedValues(localized_strings); |
| 131 AddMessageHandler(handler->Attach(this)); | 131 AddMessageHandler(handler->Attach(this)); |
| 132 } | 132 } |
| OLD | NEW |