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

Side by Side Diff: chrome/browser/chromeos/login/ui/webui_login_view.cc

Issue 542623002: Minimal support for OOBE/login for chrome-athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: overscroll Created 6 years, 3 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 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/chromeos/login/ui/webui_login_view.h" 5 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) 167 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i)
168 AddAccelerator(i->first); 168 AddAccelerator(i->first);
169 } 169 }
170 170
171 WebUILoginView::~WebUILoginView() { 171 WebUILoginView::~WebUILoginView() {
172 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 172 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
173 observer_list_, 173 observer_list_,
174 OnHostDestroying()); 174 OnHostDestroying());
175 175
176 #if !defined(USE_ATHENA)
176 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) { 177 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) {
177 ash::Shell::GetInstance()->GetPrimarySystemTray()-> 178 ash::Shell::GetInstance()->GetPrimarySystemTray()->
178 SetNextFocusableView(NULL); 179 SetNextFocusableView(NULL);
179 } 180 }
181 #endif
180 } 182 }
181 183
182 void WebUILoginView::Init() { 184 void WebUILoginView::Init() {
183 Profile* signin_profile = ProfileHelper::GetSigninProfile(); 185 Profile* signin_profile = ProfileHelper::GetSigninProfile();
184 auth_extension_.reset(new ScopedGaiaAuthExtension(signin_profile)); 186 auth_extension_.reset(new ScopedGaiaAuthExtension(signin_profile));
185 webui_login_ = new views::WebView(signin_profile); 187 webui_login_ = new views::WebView(signin_profile);
186 webui_login_->set_allow_accelerators(true); 188 webui_login_->set_allow_accelerators(true);
187 AddChildView(webui_login_); 189 AddChildView(webui_login_);
188 190
189 WebContents* web_contents = webui_login_->GetWebContents(); 191 WebContents* web_contents = webui_login_->GetWebContents();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 *network, NULL, GetNativeWindow()); 308 *network, NULL, GetNativeWindow());
307 dialog->Show(); 309 dialog->Show();
308 } 310 }
309 311
310 void WebUILoginView::OnPostponedShow() { 312 void WebUILoginView::OnPostponedShow() {
311 set_is_hidden(false); 313 set_is_hidden(false);
312 OnLoginPromptVisible(); 314 OnLoginPromptVisible();
313 } 315 }
314 316
315 void WebUILoginView::SetStatusAreaVisible(bool visible) { 317 void WebUILoginView::SetStatusAreaVisible(bool visible) {
318 #if !defined(USE_ATHENA)
316 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) { 319 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) {
317 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 320 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
318 if (visible) { 321 if (visible) {
319 // Tray may have been initialized being hidden. 322 // Tray may have been initialized being hidden.
320 tray->SetVisible(visible); 323 tray->SetVisible(visible);
321 tray->GetWidget()->Show(); 324 tray->GetWidget()->Show();
322 } else { 325 } else {
323 tray->GetWidget()->Hide(); 326 tray->GetWidget()->Hide();
324 } 327 }
325 } 328 }
329 #endif
326 } 330 }
327 331
328 void WebUILoginView::SetUIEnabled(bool enabled) { 332 void WebUILoginView::SetUIEnabled(bool enabled) {
329 forward_keyboard_event_ = enabled; 333 forward_keyboard_event_ = enabled;
334 #if !defined(USE_ATHENA)
330 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); 335 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled);
336 #endif
331 } 337 }
332 338
333 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) { 339 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) {
334 DCHECK(frame_observer); 340 DCHECK(frame_observer);
335 DCHECK(!frame_observer_list_.HasObserver(frame_observer)); 341 DCHECK(!frame_observer_list_.HasObserver(frame_observer));
336 frame_observer_list_.AddObserver(frame_observer); 342 frame_observer_list_.AddObserver(frame_observer);
337 } 343 }
338 344
339 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) { 345 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) {
340 DCHECK(frame_observer); 346 DCHECK(frame_observer);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { 425 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const {
420 return true; 426 return true;
421 } 427 }
422 428
423 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { 429 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) {
424 // In case of blocked UI (ex.: sign in is in progress) 430 // In case of blocked UI (ex.: sign in is in progress)
425 // we should not process focus change events. 431 // we should not process focus change events.
426 if (!forward_keyboard_event_) 432 if (!forward_keyboard_event_)
427 return false; 433 return false;
428 434
435 #if !defined(USE_ATHENA)
429 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 436 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
430 if (tray && tray->GetWidget()->IsVisible()) { 437 if (tray && tray->GetWidget()->IsVisible()) {
431 tray->SetNextFocusableView(this); 438 tray->SetNextFocusableView(this);
432 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD : 439 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD :
433 ash::Shell::FORWARD); 440 ash::Shell::FORWARD);
434 } 441 }
442 #endif
435 443
436 return true; 444 return true;
437 } 445 }
438 446
439 void WebUILoginView::RequestMediaAccessPermission( 447 void WebUILoginView::RequestMediaAccessPermission(
440 WebContents* web_contents, 448 WebContents* web_contents,
441 const content::MediaStreamRequest& request, 449 const content::MediaStreamRequest& request,
442 const content::MediaResponseCallback& callback) { 450 const content::MediaResponseCallback& callback) {
443 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) 451 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback))
444 NOTREACHED() << "Media stream not allowed for WebUI"; 452 NOTREACHED() << "Media stream not allowed for WebUI";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 webui_visible_ = true; 493 webui_visible_ = true;
486 } 494 }
487 495
488 void WebUILoginView::ReturnFocus(bool reverse) { 496 void WebUILoginView::ReturnFocus(bool reverse) {
489 // Return the focus to the web contents. 497 // Return the focus to the web contents.
490 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); 498 webui_login_->web_contents()->FocusThroughTabTraversal(reverse);
491 GetWidget()->Activate(); 499 GetWidget()->Activate();
492 } 500 }
493 501
494 } // namespace chromeos 502 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698