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