OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/location_bar/search_button.h" | 5 #include "chrome/browser/ui/views/location_bar/search_button.h" |
6 | 6 |
7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
8 #include "ui/base/theme_provider.h" | 8 #include "ui/base/theme_provider.h" |
9 #include "ui/views/controls/button/label_button_border.h" | 9 #include "ui/views/controls/button/label_button_border.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 const int kSearchButtonPressedImages[] = | 31 const int kSearchButtonPressedImages[] = |
32 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_PRESSED); | 32 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_PRESSED); |
33 border->SetPainter( | 33 border->SetPainter( |
34 false, views::Button::STATE_PRESSED, | 34 false, views::Button::STATE_PRESSED, |
35 views::Painter::CreateImageGridPainter(kSearchButtonPressedImages)); | 35 views::Painter::CreateImageGridPainter(kSearchButtonPressedImages)); |
36 border->SetPainter(false, views::Button::STATE_DISABLED, NULL); | 36 border->SetPainter(false, views::Button::STATE_DISABLED, NULL); |
37 border->SetPainter(true, views::Button::STATE_NORMAL, NULL); | 37 border->SetPainter(true, views::Button::STATE_NORMAL, NULL); |
38 border->SetPainter(true, views::Button::STATE_HOVERED, NULL); | 38 border->SetPainter(true, views::Button::STATE_HOVERED, NULL); |
39 border->SetPainter(true, views::Button::STATE_PRESSED, NULL); | 39 border->SetPainter(true, views::Button::STATE_PRESSED, NULL); |
40 border->SetPainter(true, views::Button::STATE_DISABLED, NULL); | 40 border->SetPainter(true, views::Button::STATE_DISABLED, NULL); |
41 SetBorder(border.PassAs<views::Border>()); | 41 SetBorder(border.Pass()); |
42 const int kSearchButtonWidth = 56; | 42 const int kSearchButtonWidth = 56; |
43 SetMinSize(gfx::Size(kSearchButtonWidth, 0)); | 43 SetMinSize(gfx::Size(kSearchButtonWidth, 0)); |
44 } | 44 } |
45 | 45 |
46 SearchButton::~SearchButton() { | 46 SearchButton::~SearchButton() { |
47 } | 47 } |
48 | 48 |
49 void SearchButton::UpdateIcon(bool is_search) { | 49 void SearchButton::UpdateIcon(bool is_search) { |
50 SetImage( | 50 SetImage( |
51 views::Button::STATE_NORMAL, | 51 views::Button::STATE_NORMAL, |
52 *GetThemeProvider()->GetImageSkiaNamed(is_search ? | 52 *GetThemeProvider()->GetImageSkiaNamed(is_search ? |
53 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW)); | 53 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW)); |
54 // Flip the arrow for RTL, but not the loupe. | 54 // Flip the arrow for RTL, but not the loupe. |
55 image()->EnableCanvasFlippingForRTLUI(!is_search); | 55 image()->EnableCanvasFlippingForRTLUI(!is_search); |
56 } | 56 } |
OLD | NEW |