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/autocomplete/autocomplete_popup_contents_view.
h" | 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <commctrl.h> | 8 #include <commctrl.h> |
9 #include <dwmapi.h> | 9 #include <dwmapi.h> |
10 #include <objidl.h> | 10 #include <objidl.h> |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 layout->AddView(CreateButton(IDS_INSTANT_OPT_IN_NO_THANKS, button_font)); | 166 layout->AddView(CreateButton(IDS_INSTANT_OPT_IN_NO_THANKS, button_font)); |
167 } | 167 } |
168 | 168 |
169 virtual void ButtonPressed(views::Button* sender, const views::Event& event) { | 169 virtual void ButtonPressed(views::Button* sender, const views::Event& event) { |
170 contents_view_->UserPressedOptIn( | 170 contents_view_->UserPressedOptIn( |
171 sender->tag() == IDS_INSTANT_OPT_IN_ENABLE); | 171 sender->tag() == IDS_INSTANT_OPT_IN_ENABLE); |
172 // WARNING: we've been deleted. | 172 // WARNING: we've been deleted. |
173 } | 173 } |
174 | 174 |
175 virtual void OnPaint(gfx::Canvas* canvas) { | 175 virtual void OnPaint(gfx::Canvas* canvas) { |
| 176 gfx::Rect paint_rect(GetLocalBounds()); |
| 177 paint_rect.Inset(kOptInBackgroundHInset, kOptInBackgroundVInset); |
176 canvas->Save(); | 178 canvas->Save(); |
177 canvas->Translate(gfx::Point(kOptInBackgroundHInset, | 179 canvas->Translate(paint_rect.origin()); |
178 kOptInBackgroundVInset)); | 180 bg_painter_->Paint(paint_rect.width(), paint_rect.height(), canvas); |
179 bg_painter_->Paint(width() - kOptInBackgroundHInset * 2, | 181 canvas->DrawRect(paint_rect, ResourceBundle::toolbar_separator_color); |
180 height() - kOptInBackgroundVInset * 2, canvas); | |
181 canvas->DrawRectInt(ResourceBundle::toolbar_separator_color, 0, 0, | |
182 width() - kOptInBackgroundHInset * 2, | |
183 height() - kOptInBackgroundVInset * 2); | |
184 canvas->Restore(); | 182 canvas->Restore(); |
185 } | 183 } |
186 | 184 |
187 private: | 185 private: |
188 // Creates and returns a button configured for the opt-in promo. | 186 // Creates and returns a button configured for the opt-in promo. |
189 views::View* CreateButton(int id, const gfx::Font& font) { | 187 views::View* CreateButton(int id, const gfx::Font& font) { |
190 // NOTE: we can't use NativeButton as the popup is a layered window and | 188 // NOTE: we can't use NativeButton as the popup is a layered window and |
191 // native buttons don't draw in layered windows. | 189 // native buttons don't draw in layered windows. |
192 // TODO(sky): these buttons look crap. Figure out the right | 190 // TODO(sky): these buttons look crap. Figure out the right |
193 // border/background to use. | 191 // border/background to use. |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 opt_in_view_ = NULL; | 686 opt_in_view_ = NULL; |
689 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 687 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
690 DCHECK(counter); | 688 DCHECK(counter); |
691 counter->Hide(); | 689 counter->Hide(); |
692 if (opt_in) { | 690 if (opt_in) { |
693 browser::ShowInstantConfirmDialogIfNecessary( | 691 browser::ShowInstantConfirmDialogIfNecessary( |
694 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 692 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
695 } | 693 } |
696 UpdatePopupAppearance(); | 694 UpdatePopupAppearance(); |
697 } | 695 } |
OLD | NEW |