Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2815)

Unified Diff: chrome/browser/wake_lock/wake_lock_infobar_delegate.h

Issue 406483004: Initial implementation of API WakeLock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/wake_lock/wake_lock_infobar_delegate.h
diff --git a/chrome/browser/wake_lock/wake_lock_infobar_delegate.h b/chrome/browser/wake_lock/wake_lock_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..97731f9a70d82573818ce39d4ab52d23392ce17b
--- /dev/null
+++ b/chrome/browser/wake_lock/wake_lock_infobar_delegate.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2014 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_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "chrome/browser/content_settings/permission_request_id.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "url/gurl.h"
+
+class InfoBarService;
+
+class WakeLockInfoBarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ typedef base::Callback<void(bool allowed)> WakeLockCallback;
+
+ static infobars::InfoBar* Create(InfoBarService* infobar_service,
+ int render_process_id,
+ int routed_id,
+ WakeLockCallback callback);
+
+ private:
+ WakeLockInfoBarDelegate(int render_process_id,
+ int routed_id,
+ const std::string& url,
+ WakeLockCallback callback);
+ virtual ~WakeLockInfoBarDelegate();
+
+ // ConfirmInfoBarDelegate:
+ virtual bool Accept() OVERRIDE;
+ virtual bool Cancel() OVERRIDE;
+ virtual void InfoBarDismissed() OVERRIDE;
+ virtual int GetIconID() const OVERRIDE;
+ virtual Type GetInfoBarType() const OVERRIDE;
+ virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
+ virtual base::string16 GetMessageText() const OVERRIDE;
+
+ void set_user_has_interacted() {
+ user_has_interacted_ = true;
+ }
+ void SetPermission(bool update_content_setting, bool allowed);
+
+ bool user_has_interacted_;
+ int render_process_id_;
+ int routed_id_;
+ std::string url_;
+ WakeLockCallback callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(WakeLockInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_WAKE_LOCK_WAKE_LOCK_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698