| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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_EULA_VIEW_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "chrome/browser/chromeos/login/message_bubble.h" | |
| 10 #include "content/browser/tab_contents/tab_contents_delegate.h" | |
| 11 #include "ui/gfx/native_widget_types.h" | |
| 12 #include "views/controls/button/button.h" | |
| 13 #include "views/controls/link_listener.h" | |
| 14 #include "views/view.h" | |
| 15 | |
| 16 namespace views { | |
| 17 | |
| 18 class Checkbox; | |
| 19 class Label; | |
| 20 class Link; | |
| 21 class NativeTextButton; | |
| 22 | |
| 23 } // namespace views | |
| 24 | |
| 25 class DOMView; | |
| 26 | |
| 27 namespace chromeos { | |
| 28 | |
| 29 class HelpAppLauncher; | |
| 30 class TpmInfoView; | |
| 31 class ViewsEulaScreenActor; | |
| 32 | |
| 33 // Delegate for TabContents that will show EULA. | |
| 34 // Blocks context menu and other actions. | |
| 35 class EULATabContentsDelegate : public TabContentsDelegate { | |
| 36 public: | |
| 37 EULATabContentsDelegate() {} | |
| 38 virtual ~EULATabContentsDelegate() {} | |
| 39 | |
| 40 protected: | |
| 41 // TabContentsDelegate implementation: | |
| 42 virtual bool IsPopup(TabContents* source); | |
| 43 virtual bool ShouldAddNavigationToHistory( | |
| 44 const history::HistoryAddPageArgs& add_page_args, | |
| 45 content::NavigationType navigation_type); | |
| 46 virtual bool HandleContextMenu(const ContextMenuParams& params); | |
| 47 | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(EULATabContentsDelegate); | |
| 50 }; | |
| 51 | |
| 52 class EulaView | |
| 53 : public views::View, | |
| 54 public views::ButtonListener, | |
| 55 public views::LinkListener, | |
| 56 public MessageBubbleDelegate, | |
| 57 public EULATabContentsDelegate { | |
| 58 public: | |
| 59 explicit EulaView(ViewsEulaScreenActor* actor); | |
| 60 virtual ~EulaView(); | |
| 61 | |
| 62 // Initialize view controls and layout. | |
| 63 void Init(); | |
| 64 | |
| 65 // Update strings from the resources. Executed on language change. | |
| 66 void UpdateLocalizedStrings(); | |
| 67 | |
| 68 // Returns the state of usage stats checkbox. | |
| 69 bool IsUsageStatsChecked() const; | |
| 70 | |
| 71 // Shows given TPM password. | |
| 72 void ShowTpmPassword(const std::string& tpm_password); | |
| 73 | |
| 74 // This method is called by the TpmInfoView dialog when it is closed. | |
| 75 void OnTpmInfoViewClosed(TpmInfoView* tpm_info_view); | |
| 76 | |
| 77 protected: | |
| 78 // views::View implementation. | |
| 79 virtual void OnLocaleChanged() OVERRIDE; | |
| 80 | |
| 81 // views::ButtonListener implementation. | |
| 82 virtual void ButtonPressed(views::Button* sender, | |
| 83 const views::Event& event) OVERRIDE; | |
| 84 | |
| 85 // views::LinkListener implementation. | |
| 86 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
| 87 | |
| 88 private: | |
| 89 // views::View implementation. | |
| 90 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) OVERRIDE; | |
| 91 virtual bool OnKeyPressed(const views::KeyEvent& e) OVERRIDE; | |
| 92 | |
| 93 // TabContentsDelegate implementation. | |
| 94 virtual void NavigationStateChanged(const TabContents* contents, | |
| 95 unsigned changed_flags) OVERRIDE; | |
| 96 virtual void HandleKeyboardEvent( | |
| 97 const NativeWebKeyboardEvent& event) OVERRIDE; | |
| 98 | |
| 99 // Loads specified URL to the specified DOMView and updates specified | |
| 100 // label with its title. | |
| 101 void LoadEulaView(DOMView* eula_view, | |
| 102 views::Label* eula_label, | |
| 103 const GURL& eula_url); | |
| 104 | |
| 105 // Overridden from views::BubbleDelegate. | |
| 106 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; | |
| 107 virtual bool CloseOnEscape() OVERRIDE; | |
| 108 virtual bool FadeInOnShow() OVERRIDE; | |
| 109 virtual void OnLinkActivated(size_t index) OVERRIDE; | |
| 110 | |
| 111 // Dialog controls. | |
| 112 views::Label* google_eula_label_; | |
| 113 DOMView* google_eula_view_; | |
| 114 views::Checkbox* usage_statistics_checkbox_; | |
| 115 views::Link* learn_more_link_; | |
| 116 views::Label* oem_eula_label_; | |
| 117 DOMView* oem_eula_view_; | |
| 118 views::Link* system_security_settings_link_; | |
| 119 views::NativeTextButton* back_button_; | |
| 120 views::NativeTextButton* continue_button_; | |
| 121 | |
| 122 // Keeps pointer to the active TpmInfoView if it is opened, NULL if is not. | |
| 123 TpmInfoView* tpm_info_view_; | |
| 124 | |
| 125 ViewsEulaScreenActor* actor_; | |
| 126 | |
| 127 // URL of the OEM EULA page (on disk). | |
| 128 GURL oem_eula_page_; | |
| 129 | |
| 130 // Help application used for help dialogs. | |
| 131 scoped_refptr<HelpAppLauncher> help_app_; | |
| 132 | |
| 133 // Pointer to shown message bubble. We don't need to delete it because | |
| 134 // it will be deleted on bubble closing. | |
| 135 MessageBubble* bubble_; | |
| 136 | |
| 137 DISALLOW_COPY_AND_ASSIGN(EulaView); | |
| 138 }; | |
| 139 | |
| 140 } // namespace chromeos | |
| 141 | |
| 142 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EULA_VIEW_H_ | |
| OLD | NEW |