Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1244)

Unified Diff: chrome/browser/ui/webui/options/search_engine_manager_handler.cc

Issue 684493002: Don't persist and sync omnibox extension keywords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/search_engine_manager_handler.cc
diff --git a/chrome/browser/ui/webui/options/search_engine_manager_handler.cc b/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
index 271a69d0a68b48bec9f6471d87898fd35a94eee3..8cd310ae2a3d46f21d8d823905654f92d76d0457 100644
--- a/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/search_engine_manager_handler.cc
@@ -129,7 +129,7 @@ void SearchEngineManagerHandler::OnModelChanged() {
for (int i = 0; i < last_default_engine_index; ++i) {
// Third argument is false, as the engine is not from an extension.
defaults_list.Append(CreateDictionaryForEngine(
- i, i == default_index, false));
+ i, i == default_index));
}
// Build the second list (other search templates).
@@ -139,7 +139,7 @@ void SearchEngineManagerHandler::OnModelChanged() {
if (last_default_engine_index < 0)
last_default_engine_index = 0;
for (int i = last_default_engine_index; i < last_other_engine_index; ++i) {
- others_list.Append(CreateDictionaryForEngine(i, i == default_index, false));
+ others_list.Append(CreateDictionaryForEngine(i, i == default_index));
}
// Build the extension keywords list.
@@ -148,7 +148,7 @@ void SearchEngineManagerHandler::OnModelChanged() {
last_other_engine_index = 0;
int engine_count = list_controller_->table_model()->RowCount();
for (int i = last_other_engine_index; i < engine_count; ++i) {
- keyword_list.Append(CreateDictionaryForEngine(i, i == default_index, true));
+ keyword_list.Append(CreateDictionaryForEngine(i, i == default_index));
}
web_ui()->CallJavascriptFunction("SearchEngineManager.updateSearchEngineList",
@@ -168,7 +168,7 @@ void SearchEngineManagerHandler::OnItemsRemoved(int start, int length) {
}
base::DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine(
- int index, bool is_default, bool is_extension) {
+ int index, bool is_default) {
TemplateURLTableModel* table_model = list_controller_->table_model();
const TemplateURL* template_url = list_controller_->GetTemplateURL(index);
@@ -191,13 +191,16 @@ base::DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine(
dict->SetString("modelIndex", base::IntToString(index));
dict->SetBoolean("canBeRemoved",
- list_controller_->CanRemove(template_url) && !is_extension);
+ list_controller_->CanRemove(template_url));
dict->SetBoolean("canBeDefault",
- list_controller_->CanMakeDefault(template_url) && !is_extension);
+ list_controller_->CanMakeDefault(template_url));
dict->SetBoolean("default", is_default);
dict->SetBoolean("canBeEdited", list_controller_->CanEdit(template_url));
- dict->SetBoolean("isExtension", is_extension);
- if (template_url->GetType() == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION) {
+ TemplateURL::Type type = template_url->GetType();
+ dict->SetBoolean("isOmniboxExtension",
+ type == TemplateURL::OMNIBOX_API_EXTENSION);
+ if (type == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION ||
+ type == TemplateURL::OMNIBOX_API_EXTENSION) {
const extensions::Extension* extension =
extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))
->GetExtensionById(template_url->GetExtensionId(),
« no previous file with comments | « chrome/browser/ui/webui/options/search_engine_manager_handler.h ('k') | components/search_engines/keyword_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698