OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "ui/views/controls/menu/menu_runner.h" | 56 #include "ui/views/controls/menu/menu_runner.h" |
57 #include "ui/views/controls/separator.h" | 57 #include "ui/views/controls/separator.h" |
58 #include "ui/views/controls/styled_label.h" | 58 #include "ui/views/controls/styled_label.h" |
59 #include "ui/views/controls/textfield/textfield.h" | 59 #include "ui/views/controls/textfield/textfield.h" |
60 #include "ui/views/controls/webview/webview.h" | 60 #include "ui/views/controls/webview/webview.h" |
61 #include "ui/views/layout/box_layout.h" | 61 #include "ui/views/layout/box_layout.h" |
62 #include "ui/views/layout/fill_layout.h" | 62 #include "ui/views/layout/fill_layout.h" |
63 #include "ui/views/layout/grid_layout.h" | 63 #include "ui/views/layout/grid_layout.h" |
64 #include "ui/views/layout/layout_constants.h" | 64 #include "ui/views/layout/layout_constants.h" |
65 #include "ui/views/painter.h" | 65 #include "ui/views/painter.h" |
| 66 #include "ui/views/view_targeter.h" |
66 #include "ui/views/widget/widget.h" | 67 #include "ui/views/widget/widget.h" |
67 #include "ui/views/window/dialog_client_view.h" | 68 #include "ui/views/window/dialog_client_view.h" |
68 #include "ui/views/window/non_client_view.h" | 69 #include "ui/views/window/non_client_view.h" |
69 | 70 |
70 namespace autofill { | 71 namespace autofill { |
71 | 72 |
72 namespace { | 73 namespace { |
73 | 74 |
74 // The width for the section container. | 75 // The width for the section container. |
75 const int kSectionContainerWidth = 440; | 76 const int kSectionContainerWidth = 440; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 views::GridLayout::USE_PREF, | 848 views::GridLayout::USE_PREF, |
848 0, | 849 0, |
849 0); | 850 0); |
850 label_bar_layout->StartRow(0, kColumnSetId); | 851 label_bar_layout->StartRow(0, kColumnSetId); |
851 label_bar_layout->AddView(label_view); | 852 label_bar_layout->AddView(label_view); |
852 label_bar_layout->AddView(proxy_button); | 853 label_bar_layout->AddView(proxy_button); |
853 | 854 |
854 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 855 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
855 AddChildView(label_bar); | 856 AddChildView(label_bar); |
856 AddChildView(controls); | 857 AddChildView(controls); |
| 858 |
| 859 SetEventTargeter( |
| 860 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
857 } | 861 } |
858 | 862 |
859 AutofillDialogViews::SectionContainer::~SectionContainer() {} | 863 AutofillDialogViews::SectionContainer::~SectionContainer() {} |
860 | 864 |
861 void AutofillDialogViews::SectionContainer::SetActive(bool active) { | 865 void AutofillDialogViews::SectionContainer::SetActive(bool active) { |
862 bool is_active = active && proxy_button_->visible(); | 866 bool is_active = active && proxy_button_->visible(); |
863 if (is_active == !!background()) | 867 if (is_active == !!background()) |
864 return; | 868 return; |
865 | 869 |
866 set_background(is_active ? | 870 set_background(is_active ? |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 } | 926 } |
923 | 927 |
924 void AutofillDialogViews::SectionContainer::OnGestureEvent( | 928 void AutofillDialogViews::SectionContainer::OnGestureEvent( |
925 ui::GestureEvent* event) { | 929 ui::GestureEvent* event) { |
926 if (!ShouldForwardEvent(*event)) | 930 if (!ShouldForwardEvent(*event)) |
927 return; | 931 return; |
928 | 932 |
929 proxy_button_->OnGestureEvent(event); | 933 proxy_button_->OnGestureEvent(event); |
930 } | 934 } |
931 | 935 |
932 views::View* AutofillDialogViews::SectionContainer::GetEventHandlerForRect( | 936 views::View* AutofillDialogViews::SectionContainer::TargetForRect( |
| 937 views::View* root, |
933 const gfx::Rect& rect) { | 938 const gfx::Rect& rect) { |
934 // TODO(tdanderson): Modify this function to support rect-based event | 939 CHECK_EQ(root, this); |
935 // targeting. | 940 views::View* handler = views::ViewTargeterDelegate::TargetForRect(root, rect); |
936 | 941 |
937 views::View* handler = views::View::GetEventHandlerForRect(rect); | |
938 // If the event is not in the label bar and there's no background to be | 942 // If the event is not in the label bar and there's no background to be |
939 // cleared, let normal event handling take place. | 943 // cleared, let normal event handling take place. |
940 if (!background() && | 944 if (!background() && |
941 rect.CenterPoint().y() > child_at(0)->bounds().bottom()) { | 945 rect.CenterPoint().y() > child_at(0)->bounds().bottom()) { |
942 return handler; | 946 return handler; |
943 } | 947 } |
944 | 948 |
945 // Special case for (CVC) inputs in the suggestion view. | 949 // Special case for (CVC) inputs in the suggestion view. |
946 if (forward_mouse_events_ && | 950 if (forward_mouse_events_ && |
947 handler->GetAncestorWithClassName(ExpandingTextfield::kViewClassName)) { | 951 handler->GetAncestorWithClassName(ExpandingTextfield::kViewClassName)) { |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 2505 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
2502 : section(section), | 2506 : section(section), |
2503 container(NULL), | 2507 container(NULL), |
2504 manual_input(NULL), | 2508 manual_input(NULL), |
2505 suggested_info(NULL), | 2509 suggested_info(NULL), |
2506 suggested_button(NULL) {} | 2510 suggested_button(NULL) {} |
2507 | 2511 |
2508 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 2512 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
2509 | 2513 |
2510 } // namespace autofill | 2514 } // namespace autofill |
OLD | NEW |