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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/dom_ui/browser_options_handler.h" | 22 #include "chrome/browser/dom_ui/browser_options_handler.h" |
23 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" | 23 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" |
24 #include "chrome/browser/dom_ui/content_settings_handler.h" | 24 #include "chrome/browser/dom_ui/content_settings_handler.h" |
25 #include "chrome/browser/dom_ui/core_options_handler.h" | 25 #include "chrome/browser/dom_ui/core_options_handler.h" |
26 #include "chrome/browser/dom_ui/font_settings_handler.h" | 26 #include "chrome/browser/dom_ui/font_settings_handler.h" |
27 #include "chrome/browser/dom_ui/import_data_handler.h" | 27 #include "chrome/browser/dom_ui/import_data_handler.h" |
28 #include "chrome/browser/dom_ui/personal_options_handler.h" | 28 #include "chrome/browser/dom_ui/personal_options_handler.h" |
29 #include "chrome/browser/dom_ui/search_engine_manager_handler.h" | 29 #include "chrome/browser/dom_ui/search_engine_manager_handler.h" |
30 #include "chrome/browser/dom_ui/stop_syncing_handler.h" | 30 #include "chrome/browser/dom_ui/stop_syncing_handler.h" |
31 #include "chrome/browser/dom_ui/sync_options_handler.h" | 31 #include "chrome/browser/dom_ui/sync_options_handler.h" |
32 #include "chrome/browser/dom_ui/dom_ui_theme_source.h" | |
33 #include "chrome/browser/metrics/user_metrics.h" | 32 #include "chrome/browser/metrics/user_metrics.h" |
34 #include "chrome/browser/pref_service.h" | 33 #include "chrome/browser/pref_service.h" |
35 #include "chrome/browser/profile.h" | 34 #include "chrome/browser/profile.h" |
36 #include "chrome/browser/tab_contents/tab_contents.h" | 35 #include "chrome/browser/tab_contents/tab_contents.h" |
37 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 36 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
38 #include "chrome/common/jstemplate_builder.h" | 37 #include "chrome/common/jstemplate_builder.h" |
39 #include "chrome/common/notification_service.h" | 38 #include "chrome/common/notification_service.h" |
40 #include "chrome/common/notification_type.h" | 39 #include "chrome/common/notification_type.h" |
41 #include "chrome/common/time_format.h" | 40 #include "chrome/common/time_format.h" |
42 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 OptionsUIHTMLSource* html_source = | 157 OptionsUIHTMLSource* html_source = |
159 new OptionsUIHTMLSource(localized_strings); | 158 new OptionsUIHTMLSource(localized_strings); |
160 | 159 |
161 // Set up the chrome://options/ source. | 160 // Set up the chrome://options/ source. |
162 ChromeThread::PostTask( | 161 ChromeThread::PostTask( |
163 ChromeThread::IO, FROM_HERE, | 162 ChromeThread::IO, FROM_HERE, |
164 NewRunnableMethod( | 163 NewRunnableMethod( |
165 Singleton<ChromeURLDataManager>::get(), | 164 Singleton<ChromeURLDataManager>::get(), |
166 &ChromeURLDataManager::AddDataSource, | 165 &ChromeURLDataManager::AddDataSource, |
167 make_scoped_refptr(html_source))); | 166 make_scoped_refptr(html_source))); |
168 | |
169 // Set up chrome://theme/ source. | |
170 DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile()); | |
171 ChromeThread::PostTask( | |
172 ChromeThread::IO, FROM_HERE, | |
173 NewRunnableMethod( | |
174 Singleton<ChromeURLDataManager>::get(), | |
175 &ChromeURLDataManager::AddDataSource, | |
176 make_scoped_refptr(theme))); | |
177 } | 167 } |
178 | 168 |
179 // static | 169 // static |
180 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { | 170 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { |
181 // TODO(csilv): uncomment this once we have a FAVICON | 171 // TODO(csilv): uncomment this once we have a FAVICON |
182 // return ResourceBundle::GetSharedInstance(). | 172 // return ResourceBundle::GetSharedInstance(). |
183 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON); | 173 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON); |
184 return NULL; | 174 return NULL; |
185 } | 175 } |
186 | 176 |
187 void OptionsUI::InitializeHandlers() { | 177 void OptionsUI::InitializeHandlers() { |
188 std::vector<DOMMessageHandler*>::iterator iter; | 178 std::vector<DOMMessageHandler*>::iterator iter; |
189 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { | 179 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { |
190 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 180 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
191 } | 181 } |
192 } | 182 } |
193 | 183 |
194 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 184 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
195 OptionsPageUIHandler* handler) { | 185 OptionsPageUIHandler* handler) { |
196 DCHECK(handler); | 186 DCHECK(handler); |
197 handler->GetLocalizedValues(localized_strings); | 187 handler->GetLocalizedValues(localized_strings); |
198 AddMessageHandler(handler->Attach(this)); | 188 AddMessageHandler(handler->Attach(this)); |
199 } | 189 } |
OLD | NEW |