OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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_UI_ECHO_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_UI_ECHO_DIALOG_VIEW_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "ui/views/controls/styled_label_listener.h" |
| 11 #include "ui/views/window/dialog_delegate.h" |
| 12 |
| 13 namespace views { |
| 14 class StyledLabel; |
| 15 } |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 class EchoDialogListener; |
| 20 |
| 21 // Dialog shown by echoPrivate extension API when getUserConsent function is |
| 22 // called. The API is used by echo extension when an offer from a service is |
| 23 // being redeemed. The dialog is shown to get an user consent. If the echo |
| 24 // extension is not allowed by policy to redeem offers, the dialog informs user |
| 25 // about this. |
| 26 class EchoDialogView : public views::DialogDelegateView, |
| 27 public views::StyledLabelListener { |
| 28 public: |
| 29 explicit EchoDialogView(EchoDialogListener* listener); |
| 30 virtual ~EchoDialogView(); |
| 31 |
| 32 // Initializes dialog layout that will be showed when echo extension is |
| 33 // allowed to redeem offers. |service_name| is the name of the service that |
| 34 // requests user consent to redeem an offer. |origin| is the service's origin |
| 35 // url. Service name should be underlined in the dialog, and hovering over its |
| 36 // label should display tooltip containing |origin|. |
| 37 // The dialog will have both OK and Cancel buttons. |
| 38 void InitForEnabledEcho(const string16& service_name, const string16& origin); |
| 39 |
| 40 // Initializes dialog layout that will be shown when echo extension is not |
| 41 // allowed to redeem offers. The dialog will be showing a message that the |
| 42 // offer redeeming is disabled by policy. |
| 43 // The dialog will have only Cancel button. |
| 44 void InitForDisabledEcho(); |
| 45 |
| 46 // Shows the dialog. |
| 47 void Show(gfx::NativeWindow parent); |
| 48 |
| 49 private: |
| 50 // views::DialogDelegate overrides. |
| 51 virtual int GetDialogButtons() const OVERRIDE; |
| 52 virtual int GetDefaultDialogButton() const OVERRIDE; |
| 53 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 54 virtual bool Cancel() OVERRIDE; |
| 55 virtual bool Accept() OVERRIDE; |
| 56 |
| 57 // views::WidgetDelegate overrides. |
| 58 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 59 virtual bool ShouldShowWindowTitle() const OVERRIDE; |
| 60 virtual bool ShouldShowWindowIcon() const OVERRIDE; |
| 61 |
| 62 // views::LinkListener override. |
| 63 virtual void StyledLabelLinkClicked(const ui::Range& range, |
| 64 int event_flags) OVERRIDE; |
| 65 |
| 66 // views::View override. |
| 67 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 68 |
| 69 // Sets the border and bounds for the styled label containing the dialog |
| 70 // text. |
| 71 void SetLabelBorderAndBounds(); |
| 72 |
| 73 views::StyledLabel* label_; |
| 74 EchoDialogListener* listener_; |
| 75 int ok_button_label_id_; |
| 76 int cancel_button_label_id_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(EchoDialogView); |
| 79 }; |
| 80 |
| 81 } // namespace chromeos |
| 82 |
| 83 #endif // CHROME_BROWSER_CHROMEOS_UI_ECHO_DIALOG_VIEW_H_ |
OLD | NEW |