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

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

Issue 332243002: Network connectivity errors handling (incl. CP) for enrollment flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implemented observer for webuiloginview Created 6 years, 6 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 tray->GetWidget()->Hide(); 304 tray->GetWidget()->Hide();
305 } 305 }
306 } 306 }
307 } 307 }
308 308
309 void WebUILoginView::SetUIEnabled(bool enabled) { 309 void WebUILoginView::SetUIEnabled(bool enabled) {
310 forward_keyboard_event_ = enabled; 310 forward_keyboard_event_ = enabled;
311 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); 311 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled);
312 } 312 }
313 313
314 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) {
315 if (frame_observer && !frame_observer_list_.HasObserver(frame_observer))
Denis Kuznetsov (DE-MUC) 2014/06/23 17:42:01 Does it make sense to have NULL frame_observer? Wh
Roman Sorokin (ftl) 2014/06/25 16:30:12 I copied this code from another function AddObserv
316 frame_observer_list_.AddObserver(frame_observer);
317 }
318
319 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) {
320 frame_observer_list_.RemoveObserver(frame_observer);
321 }
322
314 // WebUILoginView protected: --------------------------------------------------- 323 // WebUILoginView protected: ---------------------------------------------------
315 324
316 void WebUILoginView::Layout() { 325 void WebUILoginView::Layout() {
317 DCHECK(webui_login_); 326 DCHECK(webui_login_);
318 webui_login_->SetBoundsRect(bounds()); 327 webui_login_->SetBoundsRect(bounds());
319 328
320 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 329 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
321 observer_list_, 330 observer_list_,
322 OnPositionRequiresUpdate()); 331 OnPositionRequiresUpdate());
323 } 332 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 432 }
424 433
425 void WebUILoginView::DidFailProvisionalLoad( 434 void WebUILoginView::DidFailProvisionalLoad(
426 int64 frame_id, 435 int64 frame_id,
427 const base::string16& frame_unique_name, 436 const base::string16& frame_unique_name,
428 bool is_main_frame, 437 bool is_main_frame,
429 const GURL& validated_url, 438 const GURL& validated_url,
430 int error_code, 439 int error_code,
431 const base::string16& error_description, 440 const base::string16& error_description,
432 content::RenderViewHost* render_view_host) { 441 content::RenderViewHost* render_view_host) {
442 FOR_EACH_OBSERVER(
443 FrameObserver, frame_observer_list_, onFrameError(frame_unique_name));
433 if (frame_unique_name != base::UTF8ToUTF16("gaia-frame")) 444 if (frame_unique_name != base::UTF8ToUTF16("gaia-frame"))
434 return; 445 return;
435 446
436 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError", 447 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError",
437 base::FundamentalValue(-error_code), 448 base::FundamentalValue(-error_code),
438 base::StringValue(validated_url.spec())); 449 base::StringValue(validated_url.spec()));
439 } 450 }
440 451
441 void WebUILoginView::OnLoginPromptVisible() { 452 void WebUILoginView::OnLoginPromptVisible() {
442 // If we're hidden than will generate this signal once we're shown. 453 // If we're hidden than will generate this signal once we're shown.
(...skipping 12 matching lines...) Expand all
455 webui_visible_ = true; 466 webui_visible_ = true;
456 } 467 }
457 468
458 void WebUILoginView::ReturnFocus(bool reverse) { 469 void WebUILoginView::ReturnFocus(bool reverse) {
459 // Return the focus to the web contents. 470 // Return the focus to the web contents.
460 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); 471 webui_login_->web_contents()->FocusThroughTabTraversal(reverse);
461 GetWidget()->Activate(); 472 GetWidget()->Activate();
462 } 473 }
463 474
464 } // namespace chromeos 475 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698