OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
24 #include "third_party/skia/include/effects/SkGradientShader.h" | 24 #include "third_party/skia/include/effects/SkGradientShader.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
28 #include "views/background.h" | 28 #include "views/background.h" |
29 #include "views/controls/button/image_button.h" | 29 #include "views/controls/button/image_button.h" |
30 #include "views/controls/label.h" | 30 #include "views/controls/label.h" |
| 31 #include "views/controls/textfield/textfield.h" |
31 #include "views/focus/focus_manager.h" | 32 #include "views/focus/focus_manager.h" |
32 #include "views/widget/widget.h" | 33 #include "views/widget/widget.h" |
33 | 34 |
34 // The amount of whitespace to have before the find button. | 35 // The amount of whitespace to have before the find button. |
35 static const int kWhiteSpaceAfterMatchCountLabel = 1; | 36 static const int kWhiteSpaceAfterMatchCountLabel = 1; |
36 | 37 |
37 // The margins around the search field and the close button. | 38 // The margins around the search field and the close button. |
38 static const int kMarginLeftOfCloseButton = 3; | 39 static const int kMarginLeftOfCloseButton = 3; |
39 static const int kMarginRightOfCloseButton = 7; | 40 static const int kMarginRightOfCloseButton = 7; |
40 static const int kMarginLeftOfFindTextfield = 12; | 41 static const int kMarginLeftOfFindTextfield = 12; |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 find_bar_host()->GetFindBarController()->EndFindSession( | 458 find_bar_host()->GetFindBarController()->EndFindSession( |
458 FindBarController::kKeepSelection); | 459 FindBarController::kKeepSelection); |
459 break; | 460 break; |
460 default: | 461 default: |
461 NOTREACHED() << L"Unknown button"; | 462 NOTREACHED() << L"Unknown button"; |
462 break; | 463 break; |
463 } | 464 } |
464 } | 465 } |
465 | 466 |
466 //////////////////////////////////////////////////////////////////////////////// | 467 //////////////////////////////////////////////////////////////////////////////// |
467 // FindBarView, views::Textfield::Controller implementation: | 468 // FindBarView, views::TextfieldController implementation: |
468 | 469 |
469 void FindBarView::ContentsChanged(views::Textfield* sender, | 470 void FindBarView::ContentsChanged(views::Textfield* sender, |
470 const string16& new_contents) { | 471 const string16& new_contents) { |
471 #if defined(OS_LINUX) | 472 #if defined(OS_LINUX) |
472 // On gtk setting the text in the find view causes a notification. | 473 // On gtk setting the text in the find view causes a notification. |
473 if (ignore_contents_changed_) | 474 if (ignore_contents_changed_) |
474 return; | 475 return; |
475 #endif | 476 #endif |
476 | 477 |
477 FindBarController* controller = find_bar_host()->GetFindBarController(); | 478 FindBarController* controller = find_bar_host()->GetFindBarController(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 570 |
570 void FindBarView::OnThemeChanged() { | 571 void FindBarView::OnThemeChanged() { |
571 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 572 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
572 if (GetThemeProvider()) { | 573 if (GetThemeProvider()) { |
573 close_button_->SetBackground( | 574 close_button_->SetBackground( |
574 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), | 575 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TAB_TEXT), |
575 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 576 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
576 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 577 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
577 } | 578 } |
578 } | 579 } |
OLD | NEW |