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

Side by Side Diff: chrome/browser/ui/views/location_bar/search_button.cc

Issue 768413003: TEST ONLY - DO NOT SUBMIT - FOR TRYBOTS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad merge Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/location_bar/search_button.h"
6
7 #include "grit/theme_resources.h"
8 #include "ui/base/theme_provider.h"
9 #include "ui/views/controls/button/label_button_border.h"
10
11 SearchButton::SearchButton(views::ButtonListener* listener)
12 : views::LabelButton(listener, base::string16()) {
13 EnableCanvasFlippingForRTLUI(true);
14 set_triggerable_event_flags(
15 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON);
16 SetStyle(views::Button::STYLE_BUTTON);
17 SetFocusable(false);
18 SetMinSize(gfx::Size());
19 scoped_ptr<views::LabelButtonBorder> border(
20 new views::LabelButtonBorder(style()));
21 border->set_insets(gfx::Insets());
22 const int kSearchButtonNormalImages[] = IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON);
23 border->SetPainter(
24 false, views::Button::STATE_NORMAL,
25 views::Painter::CreateImageGridPainter(kSearchButtonNormalImages));
26 const int kSearchButtonHoveredImages[] =
27 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_HOVER);
28 border->SetPainter(
29 false, views::Button::STATE_HOVERED,
30 views::Painter::CreateImageGridPainter(kSearchButtonHoveredImages));
31 const int kSearchButtonPressedImages[] =
32 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_PRESSED);
33 border->SetPainter(
34 false, views::Button::STATE_PRESSED,
35 views::Painter::CreateImageGridPainter(kSearchButtonPressedImages));
36 border->SetPainter(false, views::Button::STATE_DISABLED, NULL);
37 border->SetPainter(true, views::Button::STATE_NORMAL, NULL);
38 border->SetPainter(true, views::Button::STATE_HOVERED, NULL);
39 border->SetPainter(true, views::Button::STATE_PRESSED, NULL);
40 border->SetPainter(true, views::Button::STATE_DISABLED, NULL);
41 SetBorder(border.Pass());
42 const int kSearchButtonWidth = 56;
43 SetMinSize(gfx::Size(kSearchButtonWidth, 0));
44 }
45
46 SearchButton::~SearchButton() {
47 }
48
49 void SearchButton::UpdateIcon(bool is_search) {
50 SetImage(
51 views::Button::STATE_NORMAL,
52 *GetThemeProvider()->GetImageSkiaNamed(is_search ?
53 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW));
54 // Flip the arrow for RTL, but not the loupe.
55 image()->EnableCanvasFlippingForRTLUI(!is_search);
56 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/search_button.h ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698