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

Side by Side Diff: chrome/browser/ui/views/edit_search_engine_dialog.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/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/views/edit_search_engine_dialog.h" 5 #include "chrome/browser/ui/views/edit_search_engine_dialog.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/views/controls/textfield/textfield.h" 21 #include "ui/views/controls/textfield/textfield.h"
22 #include "ui/views/layout/grid_layout.h" 22 #include "ui/views/layout/grid_layout.h"
23 #include "ui/views/layout/layout_constants.h" 23 #include "ui/views/layout/layout_constants.h"
24 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
25 25
26 using views::GridLayout; 26 using views::GridLayout;
27 using views::ImageView; 27 using views::ImageView;
28 using views::Textfield; 28 using views::Textfield;
29 29
30 30
31 namespace {
32 // Converts a URL as understood by TemplateURL to one appropriate for display
33 // to the user.
34 string16 GetDisplayURL(const TemplateURL& turl) {
35 return turl.url() ? turl.url()->DisplayURL() : string16();
36 }
37 } // namespace
38
39 namespace browser { 31 namespace browser {
40 32
41 void EditSearchEngine(gfx::NativeWindow parent, 33 void EditSearchEngine(gfx::NativeWindow parent,
42 const TemplateURL* template_url, 34 const TemplateURL* template_url,
43 EditSearchEngineControllerDelegate* delegate, 35 EditSearchEngineControllerDelegate* delegate,
44 Profile* profile) { 36 Profile* profile) {
45 EditSearchEngineDialog::Show(parent, template_url, delegate, profile); 37 EditSearchEngineDialog::Show(parent, template_url, delegate, profile);
46 } 38 }
47 39
48 } // namespace browser 40 } // namespace browser
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const views::KeyEvent& key_event) { 114 const views::KeyEvent& key_event) {
123 return false; 115 return false;
124 } 116 }
125 117
126 void EditSearchEngineDialog::Init() { 118 void EditSearchEngineDialog::Init() {
127 // Create the views we'll need. 119 // Create the views we'll need.
128 if (controller_->template_url()) { 120 if (controller_->template_url()) {
129 title_tf_ = CreateTextfield(controller_->template_url()->short_name(), 121 title_tf_ = CreateTextfield(controller_->template_url()->short_name(),
130 false); 122 false);
131 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true); 123 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true);
132 url_tf_ = CreateTextfield(GetDisplayURL(*controller_->template_url()), 124 url_tf_ = CreateTextfield(
133 false); 125 controller_->template_url()->url_ref().DisplayURL(), false);
134 // We don't allow users to edit prepopulate URLs. This is done as 126 // We don't allow users to edit prepopulate URLs. This is done as
135 // occasionally we need to update the URL of prepopulated TemplateURLs. 127 // occasionally we need to update the URL of prepopulated TemplateURLs.
136 url_tf_->SetReadOnly(controller_->template_url()->prepopulate_id() != 0); 128 url_tf_->SetReadOnly(controller_->template_url()->prepopulate_id() != 0);
137 } else { 129 } else {
138 title_tf_ = CreateTextfield(string16(), false); 130 title_tf_ = CreateTextfield(string16(), false);
139 keyword_tf_ = CreateTextfield(string16(), true); 131 keyword_tf_ = CreateTextfield(string16(), true);
140 url_tf_ = CreateTextfield(string16(), false); 132 url_tf_ = CreateTextfield(string16(), false);
141 } 133 }
142 title_iv_ = new ImageView(); 134 title_iv_ = new ImageView();
143 keyword_iv_ = new ImageView(); 135 keyword_iv_ = new ImageView();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 image_view->SetImage( 260 image_view->SetImage(
269 ResourceBundle::GetSharedInstance().GetBitmapNamed( 261 ResourceBundle::GetSharedInstance().GetBitmapNamed(
270 IDR_INPUT_GOOD)); 262 IDR_INPUT_GOOD));
271 } else { 263 } else {
272 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); 264 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id));
273 image_view->SetImage( 265 image_view->SetImage(
274 ResourceBundle::GetSharedInstance().GetBitmapNamed( 266 ResourceBundle::GetSharedInstance().GetBitmapNamed(
275 IDR_INPUT_ALERT)); 267 IDR_INPUT_ALERT));
276 } 268 }
277 } 269 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search_engines/template_url_table_model.cc ('k') | chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698