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/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 TemplateURL::Type type = template_url->type(); | 200 TemplateURL::Type type = template_url->type(); |
201 dict->SetBoolean("isOmniboxExtension", | 201 dict->SetBoolean("isOmniboxExtension", |
202 type == TemplateURL::OMNIBOX_API_EXTENSION); | 202 type == TemplateURL::OMNIBOX_API_EXTENSION); |
203 if (type == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION || | 203 if (type == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION || |
204 type == TemplateURL::OMNIBOX_API_EXTENSION) { | 204 type == TemplateURL::OMNIBOX_API_EXTENSION) { |
205 const extensions::Extension* extension = | 205 const extensions::Extension* extension = |
206 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui())) | 206 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui())) |
207 ->GetExtensionById(template_url->GetExtensionId(), | 207 ->GetExtensionById(template_url->GetExtensionId(), |
208 extensions::ExtensionRegistry::EVERYTHING); | 208 extensions::ExtensionRegistry::EVERYTHING); |
209 if (extension) { | 209 if (extension) { |
210 dict->Set("extension", | 210 dict->Set("extension", extensions::util::GetExtensionInfo(extension)); |
211 extensions::util::GetExtensionInfo(extension).release()); | |
212 } | 211 } |
213 } | 212 } |
214 return dict; | 213 return dict; |
215 } | 214 } |
216 | 215 |
217 void SearchEngineManagerHandler::SetDefaultSearchEngine( | 216 void SearchEngineManagerHandler::SetDefaultSearchEngine( |
218 const base::ListValue* args) { | 217 const base::ListValue* args) { |
219 int index; | 218 int index; |
220 if (!ExtractIntegerValue(args, &index)) { | 219 if (!ExtractIntegerValue(args, &index)) { |
221 NOTREACHED(); | 220 NOTREACHED(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 320 |
322 // Recheck validity. It's possible to get here with invalid input if e.g. the | 321 // Recheck validity. It's possible to get here with invalid input if e.g. the |
323 // user calls the right JS functions directly from the web inspector. | 322 // user calls the right JS functions directly from the web inspector. |
324 if (edit_controller_->IsTitleValid(name) && | 323 if (edit_controller_->IsTitleValid(name) && |
325 edit_controller_->IsKeywordValid(keyword) && | 324 edit_controller_->IsKeywordValid(keyword) && |
326 edit_controller_->IsURLValid(url)) | 325 edit_controller_->IsURLValid(url)) |
327 edit_controller_->AcceptAddOrEdit(name, keyword, url); | 326 edit_controller_->AcceptAddOrEdit(name, keyword, url); |
328 } | 327 } |
329 | 328 |
330 } // namespace options | 329 } // namespace options |
OLD | NEW |