summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/login/web_page_screen.h
blob: 6cf6f307f5c918be04768c45148d4e620879420e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_SCREEN_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_SCREEN_H_
#pragma once

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/timer.h"
#include "chrome/browser/chromeos/login/screen_observer.h"
#include "content/public/browser/web_contents_delegate.h"

namespace chromeos {

// Base class for wizard screen that holds web page.
class WebPageScreen : public content::WebContentsDelegate {
 public:
  explicit WebPageScreen();
  virtual ~WebPageScreen();

  // Exits from the screen with the specified exit code.
  virtual void CloseScreen(ScreenObserver::ExitCodes code) = 0;

 protected:
  // content::WebContentsDelegate implementation:
  virtual bool ShouldAddNavigationToHistory(
      const history::HistoryAddPageArgs& add_page_args,
      content::NavigationType navigation_type) OVERRIDE;
  virtual bool HandleContextMenu(
      const content::ContextMenuParams& params) OVERRIDE;

  // Called by |timeout_timer_|. Stops page fetching and closes screen.
  virtual void OnNetworkTimeout();

  // Start/stop timeout timer.
  void StartTimeoutTimer();
  void StopTimeoutTimer();

 private:
  // Timer used for network response timeout.
  base::OneShotTimer<WebPageScreen> timeout_timer_;

  DISALLOW_COPY_AND_ASSIGN(WebPageScreen);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_SCREEN_H_