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/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/autocomplete/autocomplete.h" | 13 #include "chrome/browser/autocomplete/autocomplete.h" |
14 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/custom_home_pages_table_model.h" | 16 #include "chrome/browser/custom_home_pages_table_model.h" |
17 #include "chrome/browser/instant/instant_confirm_dialog.h" | 17 #include "chrome/browser/instant/instant_confirm_dialog.h" |
18 #include "chrome/browser/net/url_fixer_upper.h" | 18 #include "chrome/browser/net/url_fixer_upper.h" |
19 #include "chrome/browser/platform_util.h" | 19 #include "chrome/browser/platform_util.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/prefs/session_startup_pref.h" | 21 #include "chrome/browser/prefs/session_startup_pref.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/search_engines/template_url.h" | 23 #include "chrome/browser/search_engines/template_url.h" |
24 #include "chrome/browser/search_engines/template_url_service.h" | 24 #include "chrome/browser/search_engines/template_url_service.h" |
25 #include "chrome/browser/search_engines/template_url_service_factory.h" | 25 #include "chrome/browser/search_engines/template_url_service_factory.h" |
26 #include "chrome/browser/ui/webui/favicon_source.h" | 26 #include "chrome/browser/ui/webui/favicon_source.h" |
27 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" | |
28 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
30 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
31 #include "content/browser/browser_thread.h" | 30 #include "content/browser/browser_thread.h" |
32 #include "content/browser/user_metrics.h" | 31 #include "content/browser/user_metrics.h" |
33 #include "content/common/notification_details.h" | 32 #include "content/common/notification_details.h" |
34 #include "content/common/notification_service.h" | 33 #include "content/common/notification_service.h" |
35 #include "content/common/notification_source.h" | 34 #include "content/common/notification_source.h" |
36 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
37 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 startup_custom_pages_table_model_.reset( | 141 startup_custom_pages_table_model_.reset( |
143 new CustomHomePagesTableModel(profile)); | 142 new CustomHomePagesTableModel(profile)); |
144 startup_custom_pages_table_model_->SetObserver(this); | 143 startup_custom_pages_table_model_->SetObserver(this); |
145 UpdateStartupPages(); | 144 UpdateStartupPages(); |
146 | 145 |
147 pref_change_registrar_.Init(profile->GetPrefs()); | 146 pref_change_registrar_.Init(profile->GetPrefs()); |
148 pref_change_registrar_.Add(prefs::kURLsToRestoreOnStartup, this); | 147 pref_change_registrar_.Add(prefs::kURLsToRestoreOnStartup, this); |
149 | 148 |
150 UpdateSearchEngines(); | 149 UpdateSearchEngines(); |
151 banner_handler_.reset( | |
152 OptionsManagedBannerHandler::Create(web_ui_, | |
153 ASCIIToUTF16("BrowserOptions"), | |
154 OPTIONS_PAGE_GENERAL)); | |
155 | 150 |
156 autocomplete_controller_.reset(new AutocompleteController(profile, this)); | 151 autocomplete_controller_.reset(new AutocompleteController(profile, this)); |
157 } | 152 } |
158 | 153 |
159 void BrowserOptionsHandler::SetHomePage(const ListValue* args) { | 154 void BrowserOptionsHandler::SetHomePage(const ListValue* args) { |
160 std::string url_string; | 155 std::string url_string; |
161 std::string do_fixup_string; | 156 std::string do_fixup_string; |
162 int do_fixup; | 157 int do_fixup; |
163 CHECK_EQ(args->GetSize(), 2U); | 158 CHECK_EQ(args->GetSize(), 2U); |
164 CHECK(args->GetString(0, &url_string)); | 159 CHECK(args->GetString(0, &url_string)); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 DictionaryValue* entry = new DictionaryValue(); | 485 DictionaryValue* entry = new DictionaryValue(); |
491 entry->SetString("title", match.description); | 486 entry->SetString("title", match.description); |
492 entry->SetString("displayURL", match.contents); | 487 entry->SetString("displayURL", match.contents); |
493 entry->SetString("url", match.destination_url.spec()); | 488 entry->SetString("url", match.destination_url.spec()); |
494 suggestions.Append(entry); | 489 suggestions.Append(entry); |
495 } | 490 } |
496 | 491 |
497 web_ui_->CallJavascriptFunction( | 492 web_ui_->CallJavascriptFunction( |
498 "BrowserOptions.updateAutocompleteSuggestions", suggestions); | 493 "BrowserOptions.updateAutocompleteSuggestions", suggestions); |
499 } | 494 } |
OLD | NEW |