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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "ui/app_list/app_list_constants.h" | 8 #include "ui/app_list/app_list_constants.h" |
9 #include "ui/app_list/app_list_model.h" | 9 #include "ui/app_list/app_list_model.h" |
10 #include "ui/app_list/app_list_view_delegate.h" | 10 #include "ui/app_list/app_list_view_delegate.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 app_list_main_view_->SetFillsBoundsOpaquely(false); | 76 app_list_main_view_->SetFillsBoundsOpaquely(false); |
77 app_list_main_view_->layer()->SetMasksToBounds(true); | 77 app_list_main_view_->layer()->SetMasksToBounds(true); |
78 #endif | 78 #endif |
79 | 79 |
80 signin_view_ = new SigninView( | 80 signin_view_ = new SigninView( |
81 GetSigninDelegate(), | 81 GetSigninDelegate(), |
82 app_list_main_view_->GetPreferredSize().width()); | 82 app_list_main_view_->GetPreferredSize().width()); |
83 AddChildView(signin_view_); | 83 AddChildView(signin_view_); |
84 | 84 |
85 set_anchor_view(anchor); | 85 set_anchor_view(anchor); |
86 set_anchor_point(anchor_point); | 86 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); |
87 set_color(kContentsBackgroundColor); | 87 set_color(kContentsBackgroundColor); |
88 set_margins(gfx::Insets()); | 88 set_margins(gfx::Insets()); |
89 set_move_with_anchor(true); | 89 set_move_with_anchor(true); |
90 set_parent_window(parent); | 90 set_parent_window(parent); |
91 set_close_on_deactivate(false); | 91 set_close_on_deactivate(false); |
92 set_close_on_esc(false); | 92 set_close_on_esc(false); |
93 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, | 93 set_anchor_view_insets(gfx::Insets(kArrowOffset, kArrowOffset, |
94 kArrowOffset, kArrowOffset)); | 94 kArrowOffset, kArrowOffset)); |
95 set_border_accepts_events(border_accepts_events); | 95 set_border_accepts_events(border_accepts_events); |
96 set_shadow(views::BubbleBorder::BIG_SHADOW); | 96 set_shadow(views::BubbleBorder::BIG_SHADOW); |
97 views::BubbleDelegateView::CreateBubble(this); | 97 views::BubbleDelegateView::CreateBubble(this); |
98 SetBubbleArrowLocation(arrow_location); | 98 SetBubbleArrowLocation(arrow_location); |
99 | 99 |
100 #if defined(USE_AURA) | 100 #if defined(USE_AURA) |
101 GetWidget()->GetNativeWindow()->layer()->SetMasksToBounds(true); | 101 GetWidget()->GetNativeWindow()->layer()->SetMasksToBounds(true); |
102 GetBubbleFrameView()->set_background(new AppListBackground( | 102 GetBubbleFrameView()->set_background(new AppListBackground( |
103 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(), | 103 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(), |
104 app_list_main_view_->search_box_view())); | 104 app_list_main_view_->search_box_view())); |
105 set_background(NULL); | 105 set_background(NULL); |
106 #else | 106 #else |
107 set_background(new AppListBackground( | 107 set_background(new AppListBackground( |
108 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(), | 108 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(), |
109 app_list_main_view_->search_box_view())); | 109 app_list_main_view_->search_box_view())); |
110 #endif | 110 #endif |
111 } | 111 } |
112 | 112 |
113 void AppListView::SetBubbleArrowLocation( | 113 void AppListView::SetBubbleArrowLocation( |
114 views::BubbleBorder::ArrowLocation arrow_location) { | 114 views::BubbleBorder::ArrowLocation arrow_location) { |
115 GetBubbleFrameView()->bubble_border()->set_arrow_location(arrow_location); | 115 GetBubbleFrameView()->bubble_border()->set_arrow_location(arrow_location); |
116 SizeToContents(); // Recalcuates with new border. | 116 SizeToContents(); // Recalcuates with new border. |
117 GetBubbleFrameView()->SchedulePaint(); | 117 GetBubbleFrameView()->SchedulePaint(); |
118 } | 118 } |
119 | 119 |
120 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { | 120 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { |
121 set_anchor_point(anchor_point); | 121 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); |
122 SizeToContents(); // Repositions view relative to the anchor. | 122 SizeToContents(); // Repositions view relative to the anchor. |
123 } | 123 } |
124 | 124 |
125 void AppListView::ShowWhenReady() { | 125 void AppListView::ShowWhenReady() { |
126 app_list_main_view_->ShowAppListWhenReady(); | 126 app_list_main_view_->ShowAppListWhenReady(); |
127 } | 127 } |
128 | 128 |
129 void AppListView::Close() { | 129 void AppListView::Close() { |
130 app_list_main_view_->Close(); | 130 app_list_main_view_->Close(); |
131 | 131 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 void AppListView::OnSigninSuccess() { | 227 void AppListView::OnSigninSuccess() { |
228 Layout(); | 228 Layout(); |
229 } | 229 } |
230 | 230 |
231 SigninDelegate* AppListView::GetSigninDelegate() { | 231 SigninDelegate* AppListView::GetSigninDelegate() { |
232 return delegate_ ? delegate_->GetSigninDelegate() : NULL; | 232 return delegate_ ? delegate_->GetSigninDelegate() : NULL; |
233 } | 233 } |
234 | 234 |
235 } // namespace app_list | 235 } // namespace app_list |
OLD | NEW |