| 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); | |
| 178 canvas->Save(); | 176 canvas->Save(); |
| 179 canvas->Translate(paint_rect.origin()); | 177 canvas->Translate(gfx::Point(kOptInBackgroundHInset, |
| 180 bg_painter_->Paint(paint_rect.width(), paint_rect.height(), canvas); | 178 kOptInBackgroundVInset)); |
| 181 canvas->DrawRect(paint_rect, ResourceBundle::toolbar_separator_color); | 179 bg_painter_->Paint(width() - kOptInBackgroundHInset * 2, |
| 180 height() - kOptInBackgroundVInset * 2, canvas); |
| 181 canvas->DrawRectInt(ResourceBundle::toolbar_separator_color, 0, 0, |
| 182 width() - kOptInBackgroundHInset * 2, |
| 183 height() - kOptInBackgroundVInset * 2); |
| 182 canvas->Restore(); | 184 canvas->Restore(); |
| 183 } | 185 } |
| 184 | 186 |
| 185 private: | 187 private: |
| 186 // Creates and returns a button configured for the opt-in promo. | 188 // Creates and returns a button configured for the opt-in promo. |
| 187 views::View* CreateButton(int id, const gfx::Font& font) { | 189 views::View* CreateButton(int id, const gfx::Font& font) { |
| 188 // NOTE: we can't use NativeButton as the popup is a layered window and | 190 // NOTE: we can't use NativeButton as the popup is a layered window and |
| 189 // native buttons don't draw in layered windows. | 191 // native buttons don't draw in layered windows. |
| 190 // TODO(sky): these buttons look crap. Figure out the right | 192 // TODO(sky): these buttons look crap. Figure out the right |
| 191 // border/background to use. | 193 // border/background to use. |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 opt_in_view_ = NULL; | 688 opt_in_view_ = NULL; |
| 687 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 689 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
| 688 DCHECK(counter); | 690 DCHECK(counter); |
| 689 counter->Hide(); | 691 counter->Hide(); |
| 690 if (opt_in) { | 692 if (opt_in) { |
| 691 browser::ShowInstantConfirmDialogIfNecessary( | 693 browser::ShowInstantConfirmDialogIfNecessary( |
| 692 location_bar_->GetWidget()->GetNativeWindow(), profile_); | 694 location_bar_->GetWidget()->GetNativeWindow(), profile_); |
| 693 } | 695 } |
| 694 UpdatePopupAppearance(); | 696 UpdatePopupAppearance(); |
| 695 } | 697 } |
| OLD | NEW |