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

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

Issue 9965143: Revert 130431 - Move the URL string from TemplateURLRef onto the owning TemplateURL. This will mak… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months 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 | Annotate | Revision Log
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/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const std::string& url) { 56 const std::string& url) {
57 const int index = table_model_->IndexOfTemplateURL(template_url); 57 const int index = table_model_->IndexOfTemplateURL(template_url);
58 if (index == -1) { 58 if (index == -1) {
59 // Will happen if url was deleted out from under us while the user was 59 // Will happen if url was deleted out from under us while the user was
60 // editing it. 60 // editing it.
61 return; 61 return;
62 } 62 }
63 63
64 // Don't do anything if the entry didn't change. 64 // Don't do anything if the entry didn't change.
65 if ((template_url->short_name() == title) && 65 if ((template_url->short_name() == title) &&
66 (template_url->keyword() == keyword) && (template_url->url() == url)) 66 (template_url->keyword() == keyword) &&
67 ((url.empty() && !template_url->url()) ||
68 (!url.empty() && template_url->url() &&
69 template_url->url()->url() == url)))
67 return; 70 return;
68 71
69 table_model_->ModifyTemplateURL(index, title, keyword, url); 72 table_model_->ModifyTemplateURL(index, title, keyword, url);
70 73
71 content::RecordAction(UserMetricsAction("KeywordEditor_ModifiedKeyword")); 74 content::RecordAction(UserMetricsAction("KeywordEditor_ModifiedKeyword"));
72 } 75 }
73 76
74 bool KeywordEditorController::CanEdit(const TemplateURL* url) const { 77 bool KeywordEditorController::CanEdit(const TemplateURL* url) const {
75 return !url_model()->is_default_search_managed() || 78 return !url_model()->is_default_search_managed() ||
76 url != url_model()->GetDefaultSearchProvider(); 79 url != url_model()->GetDefaultSearchProvider();
(...skipping 20 matching lines...) Expand all
97 return url_model()->loaded(); 100 return url_model()->loaded();
98 } 101 }
99 102
100 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const { 103 const TemplateURL* KeywordEditorController::GetTemplateURL(int index) const {
101 return table_model_->GetTemplateURL(index); 104 return table_model_->GetTemplateURL(index);
102 } 105 }
103 106
104 TemplateURLService* KeywordEditorController::url_model() const { 107 TemplateURLService* KeywordEditorController::url_model() const {
105 return table_model_->template_url_service(); 108 return table_model_->template_url_service();
106 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698