Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/dom_ui/options_ui.cc

Issue 2868067: Implement new mock for user options page per chromium-os:5028 (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: per arv's comments #2 Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/mock_cros_settings.cc ('k') | chrome/browser/resources/options.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/singleton.h" 12 #include "base/singleton.h"
13 #include "base/string_piece.h" 13 #include "base/string_piece.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/thread.h" 15 #include "base/thread.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/chrome_thread.h" 18 #include "chrome/browser/chrome_thread.h"
19 #include "chrome/browser/dom_ui/add_startup_page_handler.h" 19 #include "chrome/browser/dom_ui/add_startup_page_handler.h"
20 #include "chrome/browser/dom_ui/advanced_options_handler.h" 20 #include "chrome/browser/dom_ui/advanced_options_handler.h"
21 #include "chrome/browser/dom_ui/browser_options_handler.h" 21 #include "chrome/browser/dom_ui/browser_options_handler.h"
22 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" 22 #include "chrome/browser/dom_ui/clear_browser_data_handler.h"
23 #include "chrome/browser/dom_ui/content_settings_handler.h" 23 #include "chrome/browser/dom_ui/content_settings_handler.h"
24 #include "chrome/browser/dom_ui/core_options_handler.h" 24 #include "chrome/browser/dom_ui/core_options_handler.h"
25 #include "chrome/browser/dom_ui/font_settings_handler.h" 25 #include "chrome/browser/dom_ui/font_settings_handler.h"
26 #include "chrome/browser/dom_ui/personal_options_handler.h" 26 #include "chrome/browser/dom_ui/personal_options_handler.h"
27 #include "chrome/browser/dom_ui/sync_options_handler.h" 27 #include "chrome/browser/dom_ui/sync_options_handler.h"
28 #include "chrome/browser/dom_ui/dom_ui_theme_source.h"
28 #include "chrome/browser/metrics/user_metrics.h" 29 #include "chrome/browser/metrics/user_metrics.h"
29 #include "chrome/browser/pref_service.h" 30 #include "chrome/browser/pref_service.h"
30 #include "chrome/browser/profile.h" 31 #include "chrome/browser/profile.h"
31 #include "chrome/browser/tab_contents/tab_contents.h" 32 #include "chrome/browser/tab_contents/tab_contents.h"
32 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 33 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
33 #include "chrome/common/jstemplate_builder.h" 34 #include "chrome/common/jstemplate_builder.h"
34 #include "chrome/common/notification_service.h" 35 #include "chrome/common/notification_service.h"
35 #include "chrome/common/notification_type.h" 36 #include "chrome/common/notification_type.h"
36 #include "chrome/common/time_format.h" 37 #include "chrome/common/time_format.h"
37 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 OptionsUIHTMLSource* html_source = 146 OptionsUIHTMLSource* html_source =
146 new OptionsUIHTMLSource(localized_strings); 147 new OptionsUIHTMLSource(localized_strings);
147 148
148 // Set up the chrome://options/ source. 149 // Set up the chrome://options/ source.
149 ChromeThread::PostTask( 150 ChromeThread::PostTask(
150 ChromeThread::IO, FROM_HERE, 151 ChromeThread::IO, FROM_HERE,
151 NewRunnableMethod( 152 NewRunnableMethod(
152 Singleton<ChromeURLDataManager>::get(), 153 Singleton<ChromeURLDataManager>::get(),
153 &ChromeURLDataManager::AddDataSource, 154 &ChromeURLDataManager::AddDataSource,
154 make_scoped_refptr(html_source))); 155 make_scoped_refptr(html_source)));
156
157 // Set up chrome://theme/ source.
158 DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile());
159 ChromeThread::PostTask(
160 ChromeThread::IO, FROM_HERE,
161 NewRunnableMethod(
162 Singleton<ChromeURLDataManager>::get(),
163 &ChromeURLDataManager::AddDataSource,
164 make_scoped_refptr(theme)));
155 } 165 }
156 166
157 // static 167 // static
158 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { 168 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
159 // TODO(csilv): uncomment this once we have a FAVICON 169 // TODO(csilv): uncomment this once we have a FAVICON
160 // return ResourceBundle::GetSharedInstance(). 170 // return ResourceBundle::GetSharedInstance().
161 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON); 171 // LoadDataResourceBytes(IDR_OPTIONS_FAVICON);
162 return NULL; 172 return NULL;
163 } 173 }
164 174
165 void OptionsUI::InitializeHandlers() { 175 void OptionsUI::InitializeHandlers() {
166 std::vector<DOMMessageHandler*>::iterator iter; 176 std::vector<DOMMessageHandler*>::iterator iter;
167 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { 177 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) {
168 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); 178 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
169 } 179 }
170 } 180 }
171 181
172 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, 182 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings,
173 OptionsPageUIHandler* handler) { 183 OptionsPageUIHandler* handler) {
174 DCHECK(handler); 184 DCHECK(handler);
175 handler->GetLocalizedValues(localized_strings); 185 handler->GetLocalizedValues(localized_strings);
176 AddMessageHandler(handler->Attach(this)); 186 AddMessageHandler(handler->Attach(this));
177 } 187 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/mock_cros_settings.cc ('k') | chrome/browser/resources/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698