OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/public/cpp/bindings/strong_binding.h" | 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
10 #include "third_party/WebKit/public/platform/modules/budget_service/budget_servi
ce.mojom.h" | 10 #include "third_party/WebKit/public/platform/modules/budget_service/budget_servi
ce.mojom.h" |
11 | 11 |
12 // Implementation of the BudgetService Mojo service provided by the browser | 12 // Implementation of the BudgetService Mojo service provided by the browser |
13 // layer. It is responsible for dispatching budget requests to the | 13 // layer. It is responsible for dispatching budget requests to the |
14 // BudgetManager. | 14 // BudgetManager. |
15 class BudgetServiceImpl : public blink::mojom::BudgetService { | 15 class BudgetServiceImpl : public blink::mojom::BudgetService { |
16 public: | 16 public: |
17 static void Create(int render_process_id, | 17 static void Create(int render_process_id, |
18 blink::mojom::BudgetServiceRequest request); | 18 blink::mojom::BudgetServiceRequest request); |
19 | 19 |
20 // blink::mojom::BudgetService implementation. | 20 // blink::mojom::BudgetService implementation. |
21 void GetCost(blink::mojom::BudgetOperationType operation, | 21 void GetCost(blink::mojom::BudgetOperationType operation, |
22 const GetCostCallback& callback) override; | 22 const GetCostCallback& callback) override; |
23 void GetBudget(const url::Origin& origin, | 23 void GetBudget(const url::Origin& origin, |
24 const GetBudgetCallback& callbac) override; | 24 const GetBudgetCallback& callback) override; |
| 25 void Reserve(const url::Origin& origin, |
| 26 blink::mojom::BudgetOperationType operation, |
| 27 const ReserveCallback& callback) override; |
25 | 28 |
26 private: | 29 private: |
27 BudgetServiceImpl(int render_process_id, | 30 BudgetServiceImpl(int render_process_id, |
28 blink::mojom::BudgetServiceRequest request); | 31 blink::mojom::BudgetServiceRequest request); |
29 ~BudgetServiceImpl() override; | 32 ~BudgetServiceImpl() override; |
30 | 33 |
31 // Render process ID is used to get the browser context. | 34 // Render process ID is used to get the browser context. |
32 int render_process_id_; | 35 int render_process_id_; |
33 | 36 |
34 // The lifetime of the mojo service is tied to the lifetime of the connection. | 37 // The lifetime of the mojo service is tied to the lifetime of the connection. |
35 mojo::StrongBinding<blink::mojom::BudgetService> binding_; | 38 mojo::StrongBinding<blink::mojom::BudgetService> binding_; |
36 | 39 |
37 DISALLOW_COPY_AND_ASSIGN(BudgetServiceImpl); | 40 DISALLOW_COPY_AND_ASSIGN(BudgetServiceImpl); |
38 }; | 41 }; |
39 | 42 |
40 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ | 43 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ |
OLD | NEW |