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