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/search_engine_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/search_engine_manager_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Build the extension keywords list. | 139 // Build the extension keywords list. |
140 ListValue keyword_list; | 140 ListValue keyword_list; |
141 ExtensionService* extension_service = | 141 ExtensionService* extension_service = |
142 Profile::FromWebUI(web_ui())->GetExtensionService(); | 142 Profile::FromWebUI(web_ui())->GetExtensionService(); |
143 if (extension_service) { | 143 if (extension_service) { |
144 const ExtensionSet* extensions = extension_service->extensions(); | 144 const ExtensionSet* extensions = extension_service->extensions(); |
145 for (ExtensionSet::const_iterator it = extensions->begin(); | 145 for (ExtensionSet::const_iterator it = extensions->begin(); |
146 it != extensions->end(); ++it) { | 146 it != extensions->end(); ++it) { |
147 if ((*it)->omnibox_keyword().size() > 0) | 147 if ((*it)->omnibox_keyword().size() > 0) |
148 keyword_list.Append(CreateDictionaryForExtension(*(*it))); | 148 keyword_list.Append(CreateDictionaryForExtension(*(*it).get())); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 web_ui()->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList", | 152 web_ui()->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList", |
153 defaults_list, others_list, keyword_list); | 153 defaults_list, others_list, keyword_list); |
154 } | 154 } |
155 | 155 |
156 void SearchEngineManagerHandler::OnItemsChanged(int start, int length) { | 156 void SearchEngineManagerHandler::OnItemsChanged(int start, int length) { |
157 OnModelChanged(); | 157 OnModelChanged(); |
158 } | 158 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 // Recheck validity. It's possible to get here with invalid input if e.g. the | 309 // Recheck validity. It's possible to get here with invalid input if e.g. the |
310 // user calls the right JS functions directly from the web inspector. | 310 // user calls the right JS functions directly from the web inspector. |
311 if (edit_controller_->IsTitleValid(name) && | 311 if (edit_controller_->IsTitleValid(name) && |
312 edit_controller_->IsKeywordValid(keyword) && | 312 edit_controller_->IsKeywordValid(keyword) && |
313 edit_controller_->IsURLValid(url)) | 313 edit_controller_->IsURLValid(url)) |
314 edit_controller_->AcceptAddOrEdit(name, keyword, url); | 314 edit_controller_->AcceptAddOrEdit(name, keyword, url); |
315 } | 315 } |
316 | 316 |
317 } // namespace options | 317 } // namespace options |
OLD | NEW |