| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/startup_pages_handler.h" | 5 #include "chrome/browser/ui/webui/options/startup_pages_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 void StartupPagesHandler::OnItemsAdded(int start, int length) { | 125 void StartupPagesHandler::OnItemsAdded(int start, int length) { |
| 126 OnModelChanged(); | 126 OnModelChanged(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void StartupPagesHandler::OnItemsRemoved(int start, int length) { | 129 void StartupPagesHandler::OnItemsRemoved(int start, int length) { |
| 130 OnModelChanged(); | 130 OnModelChanged(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void StartupPagesHandler::Observe( | 133 void StartupPagesHandler::OnPreferenceChanged(PrefServiceBase* service, |
| 134 int type, | 134 const std::string& pref_name) { |
| 135 const content::NotificationSource& source, | 135 if (pref_name == prefs::kURLsToRestoreOnStartup) { |
| 136 const content::NotificationDetails& details) { | 136 UpdateStartupPages(); |
| 137 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | |
| 138 std::string* pref = content::Details<std::string>(details).ptr(); | |
| 139 if (*pref == prefs::kURLsToRestoreOnStartup) { | |
| 140 UpdateStartupPages(); | |
| 141 } else { | |
| 142 NOTREACHED(); | |
| 143 } | |
| 144 } else { | 137 } else { |
| 145 NOTREACHED(); | 138 NOTREACHED(); |
| 146 } | 139 } |
| 147 } | 140 } |
| 148 | 141 |
| 149 void StartupPagesHandler::SetStartupPagesToCurrentPages( | 142 void StartupPagesHandler::SetStartupPagesToCurrentPages( |
| 150 const ListValue* args) { | 143 const ListValue* args) { |
| 151 startup_custom_pages_table_model_->SetToCurrentlyOpenPages(); | 144 startup_custom_pages_table_model_->SetToCurrentlyOpenPages(); |
| 152 } | 145 } |
| 153 | 146 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 252 |
| 260 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { | 253 void StartupPagesHandler::OnResultChanged(bool default_match_changed) { |
| 261 const AutocompleteResult& result = autocomplete_controller_->result(); | 254 const AutocompleteResult& result = autocomplete_controller_->result(); |
| 262 ListValue suggestions; | 255 ListValue suggestions; |
| 263 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 256 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
| 264 web_ui()->CallJavascriptFunction( | 257 web_ui()->CallJavascriptFunction( |
| 265 "StartupOverlay.updateAutocompleteSuggestions", suggestions); | 258 "StartupOverlay.updateAutocompleteSuggestions", suggestions); |
| 266 } | 259 } |
| 267 | 260 |
| 268 } // namespace options | 261 } // namespace options |
| OLD | NEW |