OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 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_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "chrome/browser/content_settings/permission_request_id.h" |
| 12 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 class InfoBarService; |
| 16 |
| 17 class WakeLockInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 18 public: |
| 19 typedef base::Callback<void(bool allowed)> WakeLockCallback; |
| 20 |
| 21 static infobars::InfoBar* Create(InfoBarService* infobar_service, |
| 22 int render_process_id, |
| 23 int routed_id, |
| 24 WakeLockCallback callback); |
| 25 |
| 26 private: |
| 27 WakeLockInfoBarDelegate(int render_process_id, |
| 28 int routed_id, |
| 29 const std::string& url, |
| 30 WakeLockCallback callback); |
| 31 virtual ~WakeLockInfoBarDelegate(); |
| 32 |
| 33 // ConfirmInfoBarDelegate: |
| 34 virtual bool Accept() OVERRIDE; |
| 35 virtual bool Cancel() OVERRIDE; |
| 36 virtual void InfoBarDismissed() OVERRIDE; |
| 37 virtual int GetIconID() const OVERRIDE; |
| 38 virtual Type GetInfoBarType() const OVERRIDE; |
| 39 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 40 virtual base::string16 GetMessageText() const OVERRIDE; |
| 41 |
| 42 void set_user_has_interacted() { |
| 43 user_has_interacted_ = true; |
| 44 } |
| 45 void SetPermission(bool update_content_setting, bool allowed); |
| 46 |
| 47 bool user_has_interacted_; |
| 48 int render_process_id_; |
| 49 int routed_id_; |
| 50 std::string url_; |
| 51 WakeLockCallback callback_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WakeLockInfoBarDelegate); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_BROWSER_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_ |
OLD | NEW |