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

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

Issue 13852009: Replace find bar RequestFocus override with OnFocus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup. Created 7 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/ui/views/find_bar_view.h ('k') | ui/views/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) 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/find_bar_view.h" 5 #include "chrome/browser/ui/views/find_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 } 492 }
493 493
494 bool FindBarView::FocusForwarderView::OnMousePressed( 494 bool FindBarView::FocusForwarderView::OnMousePressed(
495 const ui::MouseEvent& event) { 495 const ui::MouseEvent& event) {
496 if (view_to_focus_on_mousedown_) 496 if (view_to_focus_on_mousedown_)
497 view_to_focus_on_mousedown_->RequestFocus(); 497 view_to_focus_on_mousedown_->RequestFocus();
498 return true; 498 return true;
499 } 499 }
500 500
501 FindBarView::SearchTextfieldView::SearchTextfieldView() {} 501 FindBarView::SearchTextfieldView::SearchTextfieldView()
502 : select_all_on_focus_(true) {}
502 503
503 FindBarView::SearchTextfieldView::~SearchTextfieldView() {} 504 FindBarView::SearchTextfieldView::~SearchTextfieldView() {}
504 505
505 void FindBarView::SearchTextfieldView::RequestFocus() { 506 bool FindBarView::SearchTextfieldView::OnMousePressed(
506 if (HasFocus()) 507 const ui::MouseEvent& event) {
507 return; 508 select_all_on_focus_ = false;
Ben Goodger (Google) 2013/04/18 19:38:51 can you explain in more detail why this is needed?
msw 2013/04/18 20:07:25 Oh, no. It's only needed for when the view is gain
508 views::View::RequestFocus(); 509 return views::Textfield::OnMousePressed(event);
509 SelectAll(true); 510 }
511
512 void FindBarView::SearchTextfieldView::OnMouseReleased(
513 const ui::MouseEvent& event) {
514 views::Textfield::OnMouseReleased(event);
515 select_all_on_focus_ = true;
516 }
517
518 void FindBarView::SearchTextfieldView::OnFocus() {
519 views::Textfield::OnFocus();
520 if (select_all_on_focus_)
521 SelectAll(true);
510 } 522 }
511 523
512 FindBarHost* FindBarView::find_bar_host() const { 524 FindBarHost* FindBarView::find_bar_host() const {
513 return static_cast<FindBarHost*>(host()); 525 return static_cast<FindBarHost*>(host());
514 } 526 }
515 527
516 void FindBarView::OnThemeChanged() { 528 void FindBarView::OnThemeChanged() {
517 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 529 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
518 if (GetThemeProvider()) { 530 if (GetThemeProvider()) {
519 close_button_->SetBackground( 531 close_button_->SetBackground(
520 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), 532 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT),
521 rb.GetImageSkiaNamed(IDR_CLOSE_1), 533 rb.GetImageSkiaNamed(IDR_CLOSE_1),
522 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); 534 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK));
523 } 535 }
524 } 536 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698