| 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 | |
| 14 #if defined(USE_AURA) | |
| 15 #include "ui/wm/core/window_animations.h" | 13 #include "ui/wm/core/window_animations.h" |
| 16 #endif | |
| 17 | 14 |
| 18 namespace autofill { | 15 namespace autofill { |
| 19 | 16 |
| 20 const SkColor AutofillPopupBaseView::kBorderColor = | 17 const SkColor AutofillPopupBaseView::kBorderColor = |
| 21 SkColorSetARGB(0xFF, 0xC7, 0xCA, 0xCE); | 18 SkColorSetARGB(0xFF, 0xC7, 0xCA, 0xCE); |
| 22 const SkColor AutofillPopupBaseView::kHoveredBackgroundColor = | 19 const SkColor AutofillPopupBaseView::kHoveredBackgroundColor = |
| 23 SkColorSetARGB(0xFF, 0xCD, 0xCD, 0xCD); | 20 SkColorSetARGB(0xFF, 0xCD, 0xCD, 0xCD); |
| 24 const SkColor AutofillPopupBaseView::kItemTextColor = | 21 const SkColor AutofillPopupBaseView::kItemTextColor = |
| 25 SkColorSetARGB(0xFF, 0x7F, 0x7F, 0x7F); | 22 SkColorSetARGB(0xFF, 0x7F, 0x7F, 0x7F); |
| 26 const SkColor AutofillPopupBaseView::kPopupBackground = | 23 const SkColor AutofillPopupBaseView::kPopupBackground = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 59 |
| 63 // The widget is destroyed by the corresponding NativeWidget, so we use | 60 // The widget is destroyed by the corresponding NativeWidget, so we use |
| 64 // a weak pointer to hold the reference and don't have to worry about | 61 // a weak pointer to hold the reference and don't have to worry about |
| 65 // deletion. | 62 // deletion. |
| 66 views::Widget* widget = new views::Widget; | 63 views::Widget* widget = new views::Widget; |
| 67 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 64 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 68 params.delegate = this; | 65 params.delegate = this; |
| 69 params.parent = container_view(); | 66 params.parent = container_view(); |
| 70 widget->Init(params); | 67 widget->Init(params); |
| 71 widget->SetContentsView(this); | 68 widget->SetContentsView(this); |
| 72 #if defined(USE_AURA) | 69 |
| 73 // No animation for popup appearance (too distracting). | 70 // No animation for popup appearance (too distracting). |
| 74 wm::SetWindowVisibilityAnimationTransition( | 71 wm::SetWindowVisibilityAnimationTransition( |
| 75 widget->GetNativeView(), wm::ANIMATE_HIDE); | 72 widget->GetNativeView(), wm::ANIMATE_HIDE); |
| 76 #endif | |
| 77 } | 73 } |
| 78 | 74 |
| 79 SetBorder(views::Border::CreateSolidBorder(kPopupBorderThickness, | 75 SetBorder(views::Border::CreateSolidBorder(kPopupBorderThickness, |
| 80 kBorderColor)); | 76 kBorderColor)); |
| 81 | 77 |
| 82 DoUpdateBoundsAndRedrawPopup(); | 78 DoUpdateBoundsAndRedrawPopup(); |
| 83 GetWidget()->Show(); | 79 GetWidget()->Show(); |
| 84 } | 80 } |
| 85 | 81 |
| 86 void AutofillPopupBaseView::DoHide() { | 82 void AutofillPopupBaseView::DoHide() { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 if (delegate_) | 230 if (delegate_) |
| 235 delegate_->Hide(); | 231 delegate_->Hide(); |
| 236 } | 232 } |
| 237 | 233 |
| 238 gfx::NativeView AutofillPopupBaseView::container_view() { | 234 gfx::NativeView AutofillPopupBaseView::container_view() { |
| 239 return delegate_->container_view(); | 235 return delegate_->container_view(); |
| 240 } | 236 } |
| 241 | 237 |
| 242 | 238 |
| 243 } // namespace autofill | 239 } // namespace autofill |
| OLD | NEW |