Chromium Code Reviews| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 dict->SetBoolean("urlLocked", template_url->prepopulate_id() > 0); | 192 dict->SetBoolean("urlLocked", template_url->prepopulate_id() > 0); |
| 193 GURL icon_url = template_url->favicon_url(); | 193 GURL icon_url = template_url->favicon_url(); |
| 194 if (icon_url.is_valid()) | 194 if (icon_url.is_valid()) |
| 195 dict->SetString("iconURL", icon_url.spec()); | 195 dict->SetString("iconURL", icon_url.spec()); |
| 196 dict->SetString("modelIndex", base::IntToString(index)); | 196 dict->SetString("modelIndex", base::IntToString(index)); |
| 197 | 197 |
| 198 if (list_controller_->CanRemove(template_url)) | 198 if (list_controller_->CanRemove(template_url)) |
| 199 dict->SetString("canBeRemoved", "1"); | 199 dict->SetString("canBeRemoved", "1"); |
| 200 if (list_controller_->CanMakeDefault(template_url)) | 200 if (list_controller_->CanMakeDefault(template_url)) |
| 201 dict->SetString("canBeDefault", "1"); | 201 dict->SetString("canBeDefault", "1"); |
| 202 if (is_default) | 202 if (is_default) { |
| 203 dict->SetString("default", "1"); | 203 dict->SetString("default", "1"); |
| 204 if (list_controller_->url_model()->is_default_search_managed()) | |
| 205 dict->SetString("controlledBy", "policy"); | |
|
Joao da Silva
2012/10/19 12:21:21
Isn't this the same signal as !CanEdit()? If so th
bartfab (slow)
2012/10/19 12:40:27
Good catch. Done.
| |
| 206 } | |
| 204 if (list_controller_->CanEdit(template_url)) | 207 if (list_controller_->CanEdit(template_url)) |
| 205 dict->SetString("canBeEdited", "1"); | 208 dict->SetString("canBeEdited", "1"); |
| 206 | 209 |
| 207 return dict; | 210 return dict; |
| 208 } | 211 } |
| 209 | 212 |
| 210 void SearchEngineManagerHandler::SetDefaultSearchEngine(const ListValue* args) { | 213 void SearchEngineManagerHandler::SetDefaultSearchEngine(const ListValue* args) { |
| 211 int index; | 214 int index; |
| 212 if (!ExtractIntegerValue(args, &index)) { | 215 if (!ExtractIntegerValue(args, &index)) { |
| 213 NOTREACHED(); | 216 NOTREACHED(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 } | 311 } |
| 309 // Recheck validity. It's possible to get here with invalid input if e.g. the | 312 // 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. | 313 // user calls the right JS functions directly from the web inspector. |
| 311 if (edit_controller_->IsTitleValid(name) && | 314 if (edit_controller_->IsTitleValid(name) && |
| 312 edit_controller_->IsKeywordValid(keyword) && | 315 edit_controller_->IsKeywordValid(keyword) && |
| 313 edit_controller_->IsURLValid(url)) | 316 edit_controller_->IsURLValid(url)) |
| 314 edit_controller_->AcceptAddOrEdit(name, keyword, url); | 317 edit_controller_->AcceptAddOrEdit(name, keyword, url); |
| 315 } | 318 } |
| 316 | 319 |
| 317 } // namespace options | 320 } // namespace options |
| OLD | NEW |