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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
// Copyright (c) 2010 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_EULA_VIEW_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_
#pragma once
#include <string>
#include "chrome/browser/chromeos/login/view_screen.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
#include "views/view.h"
namespace views {
class Checkbox;
class Label;
class Link;
class NativeButton;
} // namespace views
class DOMView;
namespace chromeos {
// Delegate for TabContents that will show EULA.
// Blocks context menu and other actions.
class EULATabContentsDelegate : public TabContentsDelegate {
public:
EULATabContentsDelegate() {}
virtual ~EULATabContentsDelegate() {}
protected:
// TabContentsDelegate implementation:
virtual void OpenURLFromTab(TabContents* source,
const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition,
PageTransition::Type transition) {}
virtual void NavigationStateChanged(const TabContents* source,
unsigned changed_flags) {}
virtual void AddNewContents(TabContents* source,
TabContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {}
virtual void ActivateContents(TabContents* contents) {}
virtual void LoadingStateChanged(TabContents* source) {}
virtual void CloseContents(TabContents* source) {}
virtual bool IsPopup(TabContents* source) { return false; }
virtual void URLStarredChanged(TabContents* source, bool starred) {}
virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
virtual bool ShouldAddNavigationToHistory() const { return false; }
virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {}
virtual bool HandleContextMenu(const ContextMenuParams& params) {
return true;
}
private:
DISALLOW_COPY_AND_ASSIGN(EULATabContentsDelegate);
};
class EulaView
: public views::View,
public views::ButtonListener,
public views::LinkController,
public EULATabContentsDelegate {
public:
explicit EulaView(chromeos::ScreenObserver* observer);
virtual ~EulaView();
// Initialize view controls and layout.
void Init();
// Update strings from the resources. Executed on language change.
void UpdateLocalizedStrings();
protected:
// views::View implementation.
virtual void LocaleChanged();
// views::ButtonListener implementation.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
// views::LinkController implementation.
void LinkActivated(views::Link* source, int event_flags);
private:
// Loads specified URL to the specified DOMView and updates specified
// label with its title.
void LoadEulaView(DOMView* eula_view,
views::Label* eula_label,
const GURL& eula_url);
// Dialog controls.
views::Label* google_eula_label_;
DOMView* google_eula_view_;
views::Checkbox* usage_statistics_checkbox_;
views::Link* learn_more_link_;
views::Label* oem_eula_label_;
DOMView* oem_eula_view_;
views::Link* system_security_settings_link_;
views::NativeButton* cancel_button_;
views::NativeButton* continue_button_;
chromeos::ScreenObserver* observer_;
DISALLOW_COPY_AND_ASSIGN(EulaView);
};
class EulaScreen : public DefaultViewScreen<EulaView> {
public:
explicit EulaScreen(WizardScreenDelegate* delegate)
: DefaultViewScreen<EulaView>(delegate) {
}
private:
DISALLOW_COPY_AND_ASSIGN(EulaScreen);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_
|