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

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

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month 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
OLDNEW
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/default_search_view.h" 5 #include "chrome/browser/ui/views/default_search_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search_engines/template_url.h" 11 #include "chrome/browser/search_engines/template_url.h"
12 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
12 #include "chrome/browser/search_engines/template_url_service.h" 13 #include "chrome/browser/search_engines/template_url_service.h"
13 #include "chrome/browser/search_engines/template_url_service_factory.h" 14 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
15 #include "chrome/browser/themes/theme_service.h" 15 #include "chrome/browser/themes/theme_service.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/browser/ui/views/constrained_window_views.h" 17 #include "chrome/browser/ui/views/constrained_window_views.h"
18 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/locale_settings.h" 20 #include "grit/locale_settings.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/message_box_flags.h" 23 #include "ui/base/message_box_flags.h"
23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
26 #include "views/controls/button/text_button.h" 26 #include "views/controls/button/text_button.h"
27 #include "views/controls/image_view.h" 27 #include "views/controls/image_view.h"
28 #include "views/controls/label.h" 28 #include "views/controls/label.h"
29 #include "views/layout/grid_layout.h" 29 #include "views/layout/grid_layout.h"
30 #include "views/layout/layout_constants.h" 30 #include "views/layout/layout_constants.h"
31 #include "views/widget/widget.h"
31 #include "views/window/dialog_client_view.h" 32 #include "views/window/dialog_client_view.h"
32 #include "views/widget/widget.h"
33 33
34 namespace { 34 namespace {
35 35
36 // Returns a short name and logo resource id for the given host. 36 // Returns a short name and logo resource id for the given host.
37 void GetShortNameAndLogoId(PrefService* prefs, 37 void GetShortNameAndLogoId(PrefService* prefs,
38 const TemplateURL* turl, 38 const TemplateURL* turl,
39 std::wstring* short_name, 39 std::wstring* short_name,
40 int* logo_id) { 40 int* logo_id) {
41 DCHECK(prefs); 41 DCHECK(prefs);
42 DCHECK(turl); 42 DCHECK(turl);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } else { 127 } else {
128 delete proposed_default_turl; 128 delete proposed_default_turl;
129 } 129 }
130 } 130 }
131 131
132 DefaultSearchView::~DefaultSearchView() { 132 DefaultSearchView::~DefaultSearchView() {
133 } 133 }
134 134
135 void DefaultSearchView::OnPaint(gfx::Canvas* canvas) { 135 void DefaultSearchView::OnPaint(gfx::Canvas* canvas) {
136 // Fill in behind the background image with the standard gray toolbar color. 136 // Fill in behind the background image with the standard gray toolbar color.
137 canvas->FillRectInt(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), 137 canvas->FillRect(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR),
138 0, 0, width(), background_image_->height()); 138 gfx::Rect(0, 0, width(), background_image_->height()));
139 // The rest of the dialog background should be white. 139 // The rest of the dialog background should be white.
140 DCHECK(height() > background_image_->height()); 140 DCHECK(height() > background_image_->height());
141 canvas->FillRectInt(SK_ColorWHITE, 0, background_image_->height(), width(), 141 canvas->FillRect(SK_ColorWHITE,
142 height() - background_image_->height()); 142 gfx::Rect(0, background_image_->height(), width(),
143 height() - background_image_->height()));
143 } 144 }
144 145
145 void DefaultSearchView::ButtonPressed(views::Button* sender, 146 void DefaultSearchView::ButtonPressed(views::Button* sender,
146 const views::Event& event) { 147 const views::Event& event) {
147 views::DialogClientView* client = GetDialogClientView(); 148 views::DialogClientView* client = GetDialogClientView();
148 if (sender == proposed_provider_button_) 149 if (sender == proposed_provider_button_)
149 client->AcceptWindow(); 150 client->AcceptWindow();
150 else 151 else
151 client->CancelWindow(); 152 client->CancelWindow();
152 } 153 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 this, 305 this,
305 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, 306 IDS_DEFAULT_SEARCH_PROMPT_CURRENT,
306 default_short_name); 307 default_short_name);
307 layout->AddView(default_provider_button_); 308 layout->AddView(default_provider_button_);
308 proposed_provider_button_ = CreateProviderChoiceButton( 309 proposed_provider_button_ = CreateProviderChoiceButton(
309 this, 310 this,
310 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, 311 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED,
311 proposed_short_name); 312 proposed_short_name);
312 layout->AddView(proposed_provider_button_); 313 layout->AddView(proposed_provider_button_);
313 } 314 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.cc ('k') | chrome/browser/ui/views/detachable_toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698