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

Unified Diff: third_party/WebKit/Source/modules/budget_service/NavigatorBudget.h

Issue 2110833002: Basic framework for Budget API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added BudgetChunk.idl Created 4 years, 6 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: third_party/WebKit/Source/modules/budget_service/NavigatorBudget.h
diff --git a/third_party/WebKit/Source/modules/budget_service/NavigatorBudget.h b/third_party/WebKit/Source/modules/budget_service/NavigatorBudget.h
new file mode 100644
index 0000000000000000000000000000000000000000..89249899cff32cf438759f1aa7fba67236d5af91
--- /dev/null
+++ b/third_party/WebKit/Source/modules/budget_service/NavigatorBudget.h
@@ -0,0 +1,47 @@
+// Copyright 2016 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 NavigatorBudget_h
+#define NavigatorBudget_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "modules/ModulesExport.h"
+#include "platform/Supplementable.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class ExceptionState;
+class Navigator;
+class ScriptPromise;
+class ScriptState;
+
+// This is the entry point into the browser for the BudgetAPI, which is
Peter Beverloo 2016/07/01 13:21:59 nit: BudgetAPI -> Budget API
harkness 2016/07/20 09:41:48 Done.
+// designed to give Service Workers the ability to perform background
Peter Beverloo 2016/07/01 13:21:59 Service Workers -> origins
harkness 2016/07/20 09:41:48 Done.
+// operations on the user's behalf.
+class MODULES_EXPORT NavigatorBudget final
Peter Beverloo 2016/07/01 13:21:59 Why do you need MODULES_EXPORT here?
harkness 2016/07/20 09:41:48 Removed.
+ : public GarbageCollectedFinalized<NavigatorBudget>
Peter Beverloo 2016/07/01 13:21:59 Why do you need a finalizer here? This can just be
harkness 2016/07/20 09:41:48 Updated it.
+ , public Supplement<Navigator> {
+ USING_GARBAGE_COLLECTED_MIXIN(NavigatorBudget);
+ WTF_MAKE_NONCOPYABLE(NavigatorBudget);
+
+public:
+ virtual ~NavigatorBudget();
+
+ const char* supplementName();
+ NavigatorBudget& from(Navigator&);
+
+ static ScriptPromise getCost(ScriptState*, Navigator&, const AtomicString& actionType);
+ static ScriptPromise getBudget(ScriptState*, Navigator&, ExceptionState&);
+ static ScriptPromise getBudgetDetails(ScriptState*, Navigator&, ExceptionState&);
+
+ DEFINE_INLINE_TRACE() {}
+
+private:
+ explicit NavigatorBudget(Navigator&);
+};
+
+} // namespace blink
+
+#endif // NavigatorBudget_h

Powered by Google App Engine
This is Rietveld 408576698