OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/autofill/autofill_popup_base_view.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/ui/autofill/popup_constants.h" | 10 #include "chrome/browser/ui/autofill/popup_constants.h" |
11 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
13 #include "ui/wm/core/window_animations.h" | |
14 | 13 |
15 namespace autofill { | 14 namespace autofill { |
16 | 15 |
17 const SkColor AutofillPopupBaseView::kBorderColor = | 16 const SkColor AutofillPopupBaseView::kBorderColor = |
18 SkColorSetARGB(0xFF, 0xC7, 0xCA, 0xCE); | 17 SkColorSetARGB(0xFF, 0xC7, 0xCA, 0xCE); |
19 const SkColor AutofillPopupBaseView::kHoveredBackgroundColor = | 18 const SkColor AutofillPopupBaseView::kHoveredBackgroundColor = |
20 SkColorSetARGB(0xFF, 0xCD, 0xCD, 0xCD); | 19 SkColorSetARGB(0xFF, 0xCD, 0xCD, 0xCD); |
21 const SkColor AutofillPopupBaseView::kItemTextColor = | 20 const SkColor AutofillPopupBaseView::kItemTextColor = |
22 SkColorSetARGB(0xFF, 0x7F, 0x7F, 0x7F); | 21 SkColorSetARGB(0xFF, 0x7F, 0x7F, 0x7F); |
23 const SkColor AutofillPopupBaseView::kPopupBackground = | 22 const SkColor AutofillPopupBaseView::kPopupBackground = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // a weak pointer to hold the reference and don't have to worry about | 60 // a weak pointer to hold the reference and don't have to worry about |
62 // deletion. | 61 // deletion. |
63 views::Widget* widget = new views::Widget; | 62 views::Widget* widget = new views::Widget; |
64 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 63 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
65 params.delegate = this; | 64 params.delegate = this; |
66 params.parent = container_view(); | 65 params.parent = container_view(); |
67 widget->Init(params); | 66 widget->Init(params); |
68 widget->SetContentsView(this); | 67 widget->SetContentsView(this); |
69 | 68 |
70 // No animation for popup appearance (too distracting). | 69 // No animation for popup appearance (too distracting). |
71 wm::SetWindowVisibilityAnimationTransition( | 70 widget->SetVisibilityAnimationTransition(views::Widget::ANIMATE_HIDE); |
72 widget->GetNativeView(), wm::ANIMATE_HIDE); | |
73 } | 71 } |
74 | 72 |
75 SetBorder(views::Border::CreateSolidBorder(kPopupBorderThickness, | 73 SetBorder(views::Border::CreateSolidBorder(kPopupBorderThickness, |
76 kBorderColor)); | 74 kBorderColor)); |
77 | 75 |
78 DoUpdateBoundsAndRedrawPopup(); | 76 DoUpdateBoundsAndRedrawPopup(); |
79 GetWidget()->Show(); | 77 GetWidget()->Show(); |
80 | 78 |
81 // Showing the widget can change native focus (which would result in an | 79 // Showing the widget can change native focus (which would result in an |
82 // immediate hiding of the popup). Only start observing after shown. | 80 // immediate hiding of the popup). Only start observing after shown. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void AutofillPopupBaseView::HideController() { | 232 void AutofillPopupBaseView::HideController() { |
235 if (delegate_) | 233 if (delegate_) |
236 delegate_->Hide(); | 234 delegate_->Hide(); |
237 } | 235 } |
238 | 236 |
239 gfx::NativeView AutofillPopupBaseView::container_view() { | 237 gfx::NativeView AutofillPopupBaseView::container_view() { |
240 return delegate_->container_view(); | 238 return delegate_->container_view(); |
241 } | 239 } |
242 | 240 |
243 } // namespace autofill | 241 } // namespace autofill |
OLD | NEW |