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

Side by Side Diff: chrome/browser/ui/search_engines/keyword_editor_controller.cc

Issue 684493002: Don't persist and sync omnibox extension keywords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change style to c++11 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 unified diff | Download patch
OLDNEW
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/search_engines/keyword_editor_controller.h" 5 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
6 6
7 #include "base/prefs/pref_registry_simple.h" 7 #include "base/prefs/pref_registry_simple.h"
8 #include "chrome/browser/favicon/favicon_service_factory.h" 8 #include "chrome/browser/favicon/favicon_service_factory.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 9 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/search_engines/template_url_table_model.h" 10 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if ((template_url->short_name() == title) && 54 if ((template_url->short_name() == title) &&
55 (template_url->keyword() == keyword) && (template_url->url() == url)) 55 (template_url->keyword() == keyword) && (template_url->url() == url))
56 return; 56 return;
57 57
58 table_model_->ModifyTemplateURL(index, title, keyword, url); 58 table_model_->ModifyTemplateURL(index, title, keyword, url);
59 59
60 content::RecordAction(UserMetricsAction("KeywordEditor_ModifiedKeyword")); 60 content::RecordAction(UserMetricsAction("KeywordEditor_ModifiedKeyword"));
61 } 61 }
62 62
63 bool KeywordEditorController::CanEdit(const TemplateURL* url) const { 63 bool KeywordEditorController::CanEdit(const TemplateURL* url) const {
64 return (url->GetType() != TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION) && 64 return url->GetType() == TemplateURL::NORMAL &&
Peter Kasting 2014/10/29 18:55:51 Nit: Don't remove parens around this, file style i
vasilii 2014/11/03 15:14:30 Done.
65 (!url_model_->is_default_search_managed() || 65 !(url == url_model_->GetDefaultSearchProvider() &&
Peter Kasting 2014/10/29 18:55:51 Nit: Don't factor the "!" out of this, leave it di
vasilii 2014/11/03 15:14:30 Done.
66 (url != url_model_->GetDefaultSearchProvider())); 66 url_model_->is_default_search_managed());
67 } 67 }
68 68
69 bool KeywordEditorController::CanMakeDefault(const TemplateURL* url) const { 69 bool KeywordEditorController::CanMakeDefault(const TemplateURL* url) const {
70 return url_model_->CanMakeDefault(url); 70 return url_model_->CanMakeDefault(url);
71 } 71 }
72 72
73 bool KeywordEditorController::CanRemove(const TemplateURL* url) const { 73 bool KeywordEditorController::CanRemove(const TemplateURL* url) const {
74 return url != url_model_->GetDefaultSearchProvider(); 74 return url->GetType() == TemplateURL::NORMAL &&
Peter Kasting 2014/10/29 18:55:51 Nit: Extra space; parens around subexprs
vasilii 2014/11/03 15:14:30 Done.
75 url != url_model_->GetDefaultSearchProvider();
75 } 76 }
76 77
77 void KeywordEditorController::RemoveTemplateURL(int index) { 78 void KeywordEditorController::RemoveTemplateURL(int index) {
78 table_model_->Remove(index); 79 table_model_->Remove(index);
79 content::RecordAction(UserMetricsAction("KeywordEditor_RemoveKeyword")); 80 content::RecordAction(UserMetricsAction("KeywordEditor_RemoveKeyword"));
80 } 81 }
81 82
82 TemplateURL* KeywordEditorController::GetDefaultSearchProvider() { 83 TemplateURL* KeywordEditorController::GetDefaultSearchProvider() {
83 return url_model_->GetDefaultSearchProvider(); 84 return url_model_->GetDefaultSearchProvider();
84 } 85 }
85 86
86 int KeywordEditorController::MakeDefaultTemplateURL(int index) { 87 int KeywordEditorController::MakeDefaultTemplateURL(int index) {
87 return table_model_->MakeDefaultTemplateURL(index); 88 return table_model_->MakeDefaultTemplateURL(index);
88 } 89 }
89 90
90 bool KeywordEditorController::loaded() const { 91 bool KeywordEditorController::loaded() const {
91 return url_model_->loaded(); 92 return url_model_->loaded();
92 } 93 }
93 94
94 TemplateURL* KeywordEditorController::GetTemplateURL(int index) { 95 TemplateURL* KeywordEditorController::GetTemplateURL(int index) {
95 return table_model_->GetTemplateURL(index); 96 return table_model_->GetTemplateURL(index);
96 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698