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_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" |
37 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 profile->GetChromeURLDataManager()->AddDataSource( | 131 profile->GetChromeURLDataManager()->AddDataSource( |
133 new FaviconSource(profile, FaviconSource::FAVICON)); | 132 new FaviconSource(profile, FaviconSource::FAVICON)); |
134 | 133 |
135 homepage_.Init(prefs::kHomePage, profile->GetPrefs(), NULL); | 134 homepage_.Init(prefs::kHomePage, profile->GetPrefs(), NULL); |
136 default_browser_policy_.Init(prefs::kDefaultBrowserSettingEnabled, | 135 default_browser_policy_.Init(prefs::kDefaultBrowserSettingEnabled, |
137 g_browser_process->local_state(), | 136 g_browser_process->local_state(), |
138 this); | 137 this); |
139 UpdateDefaultBrowserState(); | 138 UpdateDefaultBrowserState(); |
140 UpdateStartupPages(); | 139 UpdateStartupPages(); |
141 UpdateSearchEngines(); | 140 UpdateSearchEngines(); |
142 banner_handler_.reset( | |
143 OptionsManagedBannerHandler::Create(web_ui_, | |
144 ASCIIToUTF16("BrowserOptions"), | |
145 OPTIONS_PAGE_GENERAL)); | |
146 | 141 |
147 autocomplete_controller_.reset(new AutocompleteController(profile, this)); | 142 autocomplete_controller_.reset(new AutocompleteController(profile, this)); |
148 } | 143 } |
149 | 144 |
150 void BrowserOptionsHandler::SetHomePage(const ListValue* args) { | 145 void BrowserOptionsHandler::SetHomePage(const ListValue* args) { |
151 std::string url_string; | 146 std::string url_string; |
152 std::string do_fixup_string; | 147 std::string do_fixup_string; |
153 int do_fixup; | 148 int do_fixup; |
154 CHECK_EQ(args->GetSize(), 2U); | 149 CHECK_EQ(args->GetSize(), 2U); |
155 CHECK(args->GetString(0, &url_string)); | 150 CHECK(args->GetString(0, &url_string)); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 DictionaryValue* entry = new DictionaryValue(); | 469 DictionaryValue* entry = new DictionaryValue(); |
475 entry->SetString("title", match.description); | 470 entry->SetString("title", match.description); |
476 entry->SetString("displayURL", match.contents); | 471 entry->SetString("displayURL", match.contents); |
477 entry->SetString("url", match.destination_url.spec()); | 472 entry->SetString("url", match.destination_url.spec()); |
478 suggestions.Append(entry); | 473 suggestions.Append(entry); |
479 } | 474 } |
480 | 475 |
481 web_ui_->CallJavascriptFunction( | 476 web_ui_->CallJavascriptFunction( |
482 "BrowserOptions.updateAutocompleteSuggestions", suggestions); | 477 "BrowserOptions.updateAutocompleteSuggestions", suggestions); |
483 } | 478 } |
OLD | NEW |