OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/chromeos/login/message_bubble.h" | |
10 #include "chrome/browser/chromeos/login/view_screen.h" | 11 #include "chrome/browser/chromeos/login/view_screen.h" |
11 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 12 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
12 #include "gfx/native_widget_types.h" | 13 #include "gfx/native_widget_types.h" |
13 #include "views/controls/button/button.h" | 14 #include "views/controls/button/button.h" |
14 #include "views/controls/link.h" | 15 #include "views/controls/link.h" |
15 #include "views/view.h" | 16 #include "views/view.h" |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 | 19 |
19 class Checkbox; | 20 class Checkbox; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 } | 69 } |
69 | 70 |
70 private: | 71 private: |
71 DISALLOW_COPY_AND_ASSIGN(EULATabContentsDelegate); | 72 DISALLOW_COPY_AND_ASSIGN(EULATabContentsDelegate); |
72 }; | 73 }; |
73 | 74 |
74 class EulaView | 75 class EulaView |
75 : public views::View, | 76 : public views::View, |
76 public views::ButtonListener, | 77 public views::ButtonListener, |
77 public views::LinkController, | 78 public views::LinkController, |
79 public MessageBubbleDelegate, | |
78 public EULATabContentsDelegate { | 80 public EULATabContentsDelegate { |
79 public: | 81 public: |
80 explicit EulaView(chromeos::ScreenObserver* observer); | 82 explicit EulaView(chromeos::ScreenObserver* observer); |
81 virtual ~EulaView(); | 83 virtual ~EulaView(); |
82 | 84 |
83 // Initialize view controls and layout. | 85 // Initialize view controls and layout. |
84 void Init(); | 86 void Init(); |
85 | 87 |
86 // Update strings from the resources. Executed on language change. | 88 // Update strings from the resources. Executed on language change. |
87 void UpdateLocalizedStrings(); | 89 void UpdateLocalizedStrings(); |
88 | 90 |
89 protected: | 91 protected: |
90 // views::View implementation. | 92 // views::View implementation. |
91 virtual void OnLocaleChanged(); | 93 virtual void OnLocaleChanged(); |
92 | 94 |
93 // views::ButtonListener implementation. | 95 // views::ButtonListener implementation. |
94 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 96 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
95 | 97 |
96 // views::LinkController implementation. | 98 // views::LinkController implementation. |
97 void LinkActivated(views::Link* source, int event_flags); | 99 void LinkActivated(views::Link* source, int event_flags); |
98 | 100 |
99 private: | 101 private: |
102 // views::View implementation. | |
103 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | |
104 return true; } | |
105 virtual bool OnKeyPressed(const views::KeyEvent& e); | |
106 | |
100 // TabContentsDelegate implementation. | 107 // TabContentsDelegate implementation. |
101 virtual void NavigationStateChanged(const TabContents* contents, | 108 virtual void NavigationStateChanged(const TabContents* contents, |
102 unsigned changed_flags); | 109 unsigned changed_flags); |
103 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 110 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
104 | 111 |
105 // Returns corresponding native window. | 112 // Returns corresponding native window. |
106 gfx::NativeWindow GetNativeWindow() const; | 113 gfx::NativeWindow GetNativeWindow() const; |
107 | 114 |
108 // Loads specified URL to the specified DOMView and updates specified | 115 // Loads specified URL to the specified DOMView and updates specified |
109 // label with its title. | 116 // label with its title. |
110 void LoadEulaView(DOMView* eula_view, | 117 void LoadEulaView(DOMView* eula_view, |
111 views::Label* eula_label, | 118 views::Label* eula_label, |
112 const GURL& eula_url); | 119 const GURL& eula_url); |
113 | 120 |
121 // Overridden from views::InfoBubbleDelegate. | |
122 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | |
123 bool closed_by_escape) { bubble_ = NULL; } | |
124 virtual bool CloseOnEscape() { return true; } | |
125 virtual bool FadeInOnShow() { return false; } | |
126 virtual void OnHelpLinkActivated() { } | |
Nikita (slow)
2010/09/27 17:51:01
{}
glotov
2010/09/27 18:52:01
Done.
| |
127 | |
114 // Dialog controls. | 128 // Dialog controls. |
115 views::Label* google_eula_label_; | 129 views::Label* google_eula_label_; |
116 DOMView* google_eula_view_; | 130 DOMView* google_eula_view_; |
117 views::Checkbox* usage_statistics_checkbox_; | 131 views::Checkbox* usage_statistics_checkbox_; |
118 views::Link* learn_more_link_; | 132 views::Link* learn_more_link_; |
119 views::Label* oem_eula_label_; | 133 views::Label* oem_eula_label_; |
120 DOMView* oem_eula_view_; | 134 DOMView* oem_eula_view_; |
121 views::Link* system_security_settings_link_; | 135 views::Link* system_security_settings_link_; |
122 views::NativeButton* back_button_; | 136 views::NativeButton* back_button_; |
123 views::NativeButton* continue_button_; | 137 views::NativeButton* continue_button_; |
124 | 138 |
125 chromeos::ScreenObserver* observer_; | 139 chromeos::ScreenObserver* observer_; |
126 | 140 |
127 // URL of the OEM EULA page (on disk). | 141 // URL of the OEM EULA page (on disk). |
128 GURL oem_eula_page_; | 142 GURL oem_eula_page_; |
129 | 143 |
130 // Help application used for help dialogs. | 144 // Help application used for help dialogs. |
131 scoped_ptr<HelpAppLauncher> help_app_; | 145 scoped_ptr<HelpAppLauncher> help_app_; |
132 | 146 |
147 // Pointer to shown message bubble. We don't need to delete it because | |
148 // it will be deleted on bubble closing. | |
149 MessageBubble* bubble_; | |
150 | |
133 DISALLOW_COPY_AND_ASSIGN(EulaView); | 151 DISALLOW_COPY_AND_ASSIGN(EulaView); |
134 }; | 152 }; |
135 | 153 |
136 class EulaScreen : public DefaultViewScreen<EulaView> { | 154 class EulaScreen : public DefaultViewScreen<EulaView> { |
137 public: | 155 public: |
138 explicit EulaScreen(WizardScreenDelegate* delegate) | 156 explicit EulaScreen(WizardScreenDelegate* delegate) |
139 : DefaultViewScreen<EulaView>(delegate) { | 157 : DefaultViewScreen<EulaView>(delegate) { |
140 } | 158 } |
141 private: | 159 private: |
142 DISALLOW_COPY_AND_ASSIGN(EulaScreen); | 160 DISALLOW_COPY_AND_ASSIGN(EulaScreen); |
143 }; | 161 }; |
144 | 162 |
145 } // namespace chromeos | 163 } // namespace chromeos |
146 | 164 |
147 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ | 165 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ |
OLD | NEW |