eula_screen_actor.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_ACTOR_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_ACTOR_H_
7
8#include <string>
9
10#include "googleurl/src/gurl.h"
11#include "ui/gfx/size.h"
12
13namespace chromeos {
14
15// Interface between eula screen and its representation, either WebUI or
16// Views one. Note, do not forget to call OnActorDestroyed in the dtor.
17class EulaScreenActor {
18 public:
19  // Allows us to get info from eula screen that we need.
20  class Delegate {
21   public:
22    virtual ~Delegate() {}
23
24    // Returns URL of the OEM EULA page that should be displayed using current
25    // locale and manifest. Returns empty URL otherwise.
26    virtual GURL GetOemEulaUrl() const = 0;
27
28    // Called when screen is exited. |accepted| indicates if EULA was
29    // accepted or not.
30    virtual void OnExit(bool accepted, bool usage_stats_enabled) = 0;
31
32    // Initiate TPM password fetch. Will call actor's OnPasswordFetched() when
33    // done.
34    virtual void InitiatePasswordFetch() = 0;
35
36    // Returns true if usage statistics reporting is enabled.
37    virtual bool IsUsageStatsEnabled() const = 0;
38
39    // This method is called, when actor is being destroyed. Note, if Delegate
40    // is destroyed earlier then it has to call SetDelegate(NULL).
41    virtual void OnActorDestroyed(EulaScreenActor* actor) = 0;
42  };
43
44  virtual ~EulaScreenActor() {}
45
46  virtual void PrepareToShow() = 0;
47  virtual void Show() = 0;
48  virtual void Hide() = 0;
49  virtual void SetDelegate(Delegate* delegate) = 0;
50  virtual void OnPasswordFetched(const std::string& tpm_password) = 0;
51};
52
53}  // namespace chromeos
54
55#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_ACTOR_H_
56