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

Side by Side Diff: chrome/browser/views/edit_keyword_controller.cc

Issue 62129: Find should allow keyboard scrolling while Find bar has focus (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/views/edit_keyword_controller.h ('k') | chrome/browser/views/find_bar_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/edit_keyword_controller.h" 5 #include "chrome/browser/views/edit_keyword_controller.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/metrics/user_metrics.h" 8 #include "chrome/browser/metrics/user_metrics.h"
9 #include "chrome/browser/net/url_fixer_upper.h" 9 #include "chrome/browser/net/url_fixer_upper.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
11 #include "chrome/browser/search_engines/template_url.h" 11 #include "chrome/browser/search_engines/template_url.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 views::View* EditKeywordController::GetContentsView() { 154 views::View* EditKeywordController::GetContentsView() {
155 return view_; 155 return view_;
156 } 156 }
157 157
158 void EditKeywordController::ContentsChanged(TextField* sender, 158 void EditKeywordController::ContentsChanged(TextField* sender,
159 const std::wstring& new_contents) { 159 const std::wstring& new_contents) {
160 GetDialogClientView()->UpdateDialogButtons(); 160 GetDialogClientView()->UpdateDialogButtons();
161 UpdateImageViews(); 161 UpdateImageViews();
162 } 162 }
163 163
164 void EditKeywordController::HandleKeystroke(TextField* sender, 164 bool EditKeywordController::HandleKeystroke(TextField* sender,
165 UINT message, 165 UINT message,
166 TCHAR key, 166 TCHAR key,
167 UINT repeat_count, 167 UINT repeat_count,
168 UINT flags) { 168 UINT flags) {
169 return false;
169 } 170 }
170 171
171 void EditKeywordController::Init() { 172 void EditKeywordController::Init() {
172 // Create the views we'll need. 173 // Create the views we'll need.
173 view_ = new views::View(); 174 view_ = new views::View();
174 if (template_url_) { 175 if (template_url_) {
175 title_tf_ = CreateTextField(template_url_->short_name(), false); 176 title_tf_ = CreateTextField(template_url_->short_name(), false);
176 keyword_tf_ = CreateTextField(template_url_->keyword(), true); 177 keyword_tf_ = CreateTextField(template_url_->keyword(), true);
177 url_tf_ = CreateTextField(GetDisplayURL(*template_url_), false); 178 url_tf_ = CreateTextField(GetDisplayURL(*template_url_), false);
178 // We don't allow users to edit prepopulate URLs. This is done as 179 // We don't allow users to edit prepopulate URLs. This is done as
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 fixed_scheme.append(L"://"); 322 fixed_scheme.append(L"://");
322 url.insert(0, fixed_scheme); 323 url.insert(0, fixed_scheme);
323 } 324 }
324 325
325 return url; 326 return url;
326 } 327 }
327 328
328 bool EditKeywordController::IsKeywordValid() const { 329 bool EditKeywordController::IsKeywordValid() const {
329 std::wstring keyword = keyword_tf_->GetText(); 330 std::wstring keyword = keyword_tf_->GetText();
330 if (keyword.empty()) 331 if (keyword.empty())
331 return true; // Always allow no keyword. 332 return true; // Always allow no keyword.
332 const TemplateURL* turl_with_keyword = 333 const TemplateURL* turl_with_keyword =
333 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); 334 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
334 return (turl_with_keyword == NULL || turl_with_keyword == template_url_); 335 return (turl_with_keyword == NULL || turl_with_keyword == template_url_);
335 } 336 }
336 337
337 void EditKeywordController::UpdateImageViews() { 338 void EditKeywordController::UpdateImageViews() {
338 UpdateImageView(keyword_iv_, IsKeywordValid(), 339 UpdateImageView(keyword_iv_, IsKeywordValid(),
339 IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT); 340 IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT);
340 UpdateImageView(url_iv_, IsURLValid(), IDS_SEARCH_ENGINES_INVALID_URL_TT); 341 UpdateImageView(url_iv_, IsURLValid(), IDS_SEARCH_ENGINES_INVALID_URL_TT);
341 UpdateImageView(title_iv_, !title_tf_->GetText().empty(), 342 UpdateImageView(title_iv_, !title_tf_->GetText().empty(),
(...skipping 17 matching lines...) Expand all
359 } 360 }
360 361
361 void EditKeywordController::CleanUpCancelledAdd() { 362 void EditKeywordController::CleanUpCancelledAdd() {
362 if (!keyword_editor_view_ && template_url_) { 363 if (!keyword_editor_view_ && template_url_) {
363 // When we have no KeywordEditorView, we know that the template_url_ 364 // When we have no KeywordEditorView, we know that the template_url_
364 // hasn't yet been added to the model, so we need to clean it up. 365 // hasn't yet been added to the model, so we need to clean it up.
365 delete template_url_; 366 delete template_url_;
366 template_url_ = NULL; 367 template_url_ = NULL;
367 } 368 }
368 } 369 }
OLDNEW
« no previous file with comments | « chrome/browser/views/edit_keyword_controller.h ('k') | chrome/browser/views/find_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698