• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/chromeos/login/web_page_screen.h"
6 
7 #include "base/time.h"
8 
9 using base::TimeDelta;
10 
11 namespace chromeos {
12 
13 namespace {
14 
15 // Time in seconds after page load is considered timed out.
16 const int kNetworkTimeoutSec = 10;
17 
18 }  // namespace
19 
20 ///////////////////////////////////////////////////////////////////////////////
21 // WebPageScreen, TabContentsDelegate implementation:
22 
HandleContextMenu(const ContextMenuParams & params)23 bool WebPageScreen::HandleContextMenu(const ContextMenuParams& params) {
24   // Just return true because we don't want to show context menue.
25   return true;
26 }
27 
28 ///////////////////////////////////////////////////////////////////////////////
29 // WebPageScreen, protected:
30 
OnNetworkTimeout()31 void WebPageScreen::OnNetworkTimeout() {
32   // TODO(nkostylev): Add better detection for limited connectivity.
33   // http://crosbug.com/3690
34   CloseScreen(ScreenObserver::CONNECTION_FAILED);
35 }
36 
StartTimeoutTimer()37 void WebPageScreen::StartTimeoutTimer() {
38   StopTimeoutTimer();
39   timeout_timer_.Start(TimeDelta::FromSeconds(kNetworkTimeoutSec),
40                        this,
41                        &WebPageScreen::OnNetworkTimeout);
42 }
43 
StopTimeoutTimer()44 void WebPageScreen::StopTimeoutTimer() {
45   if (timeout_timer_.IsRunning())
46     timeout_timer_.Stop();
47 }
48 
49 }  // namespace chromeos
50