Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: ui/app_list/views/app_list_view.cc

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo app_list_service_mac changes Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "ui/app_list/app_list_constants.h" 9 #include "ui/app_list/app_list_constants.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 // On non-aura the bubble has two widgets, and it's possible for the border 123 // On non-aura the bubble has two widgets, and it's possible for the border
124 // to be shown independently in odd situations. Explicitly hide the bubble 124 // to be shown independently in odd situations. Explicitly hide the bubble
125 // widget to ensure that any WM_WINDOWPOSCHANGED messages triggered by the 125 // widget to ensure that any WM_WINDOWPOSCHANGED messages triggered by the
126 // window manager do not have the SWP_SHOWWINDOW flag set which would cause 126 // window manager do not have the SWP_SHOWWINDOW flag set which would cause
127 // the border to be shown. See http://crbug.com/231687 . 127 // the border to be shown. See http://crbug.com/231687 .
128 GetWidget()->Hide(); 128 GetWidget()->Hide();
129 #endif 129 #endif
130 } 130 }
131 131
132 void AppListView::SetModel(app_list::AppListModel* model) {
133 if (GetSigninDelegate())
134 GetSigninDelegate()->RemoveObserver(this);
135 // Sets the model on the view so the view is hooked up to listen to the model.
136 // This cleans up the observers of the old model.
137 app_list_main_view_->SetModel(model);
138 // Build the model which will notify the view, updating it. This also resets
139 // the signin delegate which will fail if any observers are listening to the
140 // old delegate.
141 if (delegate_)
142 delegate_->SetModel(model);
143 // Reset the model here, freeing it. This is done after all cleanup involving
144 // references to this model is complete.
145 model_.reset(model);
146 // Sets the signin view's delegate from the AppListViewDelegate.
147 signin_view_->SetDelegate(GetSigninDelegate());
148 if (GetSigninDelegate())
149 GetSigninDelegate()->AddObserver(this);
150 // Show the signin view if the new profile is not signed in.
151 OnSigninStatusChanged();
152 }
153
132 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { 154 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) {
133 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); 155 GetBubbleFrameView()->bubble_border()->set_arrow(arrow);
134 SizeToContents(); // Recalcuates with new border. 156 SizeToContents(); // Recalcuates with new border.
135 GetBubbleFrameView()->SchedulePaint(); 157 GetBubbleFrameView()->SchedulePaint();
136 } 158 }
137 159
138 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { 160 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) {
139 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); 161 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size()));
140 SizeToContents(); // Repositions view relative to the anchor. 162 SizeToContents(); // Repositions view relative to the anchor.
141 } 163 }
(...skipping 29 matching lines...) Expand all
171 193
172 void AppListView::Prerender() { 194 void AppListView::Prerender() {
173 app_list_main_view_->Prerender(); 195 app_list_main_view_->Prerender();
174 } 196 }
175 197
176 void AppListView::OnSigninStatusChanged() { 198 void AppListView::OnSigninStatusChanged() {
177 const bool needs_signin = 199 const bool needs_signin =
178 GetSigninDelegate() && GetSigninDelegate()->NeedSignin(); 200 GetSigninDelegate() && GetSigninDelegate()->NeedSignin();
179 201
180 signin_view_->SetVisible(needs_signin); 202 signin_view_->SetVisible(needs_signin);
203 delegate_->RebuildAvatarMenuItems(model_.get());
181 app_list_main_view_->SetVisible(!needs_signin); 204 app_list_main_view_->SetVisible(!needs_signin);
182 app_list_main_view_->search_box_view()->InvalidateMenu(); 205 app_list_main_view_->search_box_view()->InvalidateMenu();
183 } 206 }
184 207
185 views::View* AppListView::GetInitiallyFocusedView() { 208 views::View* AppListView::GetInitiallyFocusedView() {
186 return app_list_main_view_->search_box_view()->search_box(); 209 return app_list_main_view_->search_box_view()->search_box();
187 } 210 }
188 211
189 gfx::ImageSkia AppListView::GetWindowIcon() { 212 gfx::ImageSkia AppListView::GetWindowIcon() {
190 if (delegate_) 213 if (delegate_)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 280
258 void AppListView::OnSigninSuccess() { 281 void AppListView::OnSigninSuccess() {
259 OnSigninStatusChanged(); 282 OnSigninStatusChanged();
260 } 283 }
261 284
262 SigninDelegate* AppListView::GetSigninDelegate() { 285 SigninDelegate* AppListView::GetSigninDelegate() {
263 return delegate_ ? delegate_->GetSigninDelegate() : NULL; 286 return delegate_ ? delegate_->GetSigninDelegate() : NULL;
264 } 287 }
265 288
266 } // namespace app_list 289 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698