| 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 "services/service_manager/public/cpp/bind_source_info.h" |
| 9 #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" |
| 10 | 11 |
| 11 // Implementation of the BudgetService Mojo service provided by the browser | 12 // Implementation of the BudgetService Mojo service provided by the browser |
| 12 // layer. It is responsible for dispatching budget requests to the | 13 // layer. It is responsible for dispatching budget requests to the |
| 13 // BudgetManager. | 14 // BudgetManager. |
| 14 class BudgetServiceImpl : public blink::mojom::BudgetService { | 15 class BudgetServiceImpl : public blink::mojom::BudgetService { |
| 15 public: | 16 public: |
| 16 explicit BudgetServiceImpl(int render_process_id); | 17 explicit BudgetServiceImpl(int render_process_id); |
| 17 ~BudgetServiceImpl() override; | 18 ~BudgetServiceImpl() override; |
| 18 | 19 |
| 19 static void Create(int render_process_id, | 20 static void Create(int render_process_id, |
| 21 const service_manager::BindSourceInfo& source_info, |
| 20 blink::mojom::BudgetServiceRequest request); | 22 blink::mojom::BudgetServiceRequest request); |
| 21 | 23 |
| 22 // blink::mojom::BudgetService implementation. | 24 // blink::mojom::BudgetService implementation. |
| 23 void GetCost(blink::mojom::BudgetOperationType operation, | 25 void GetCost(blink::mojom::BudgetOperationType operation, |
| 24 const GetCostCallback& callback) override; | 26 const GetCostCallback& callback) override; |
| 25 void GetBudget(const url::Origin& origin, | 27 void GetBudget(const url::Origin& origin, |
| 26 const GetBudgetCallback& callback) override; | 28 const GetBudgetCallback& callback) override; |
| 27 void Reserve(const url::Origin& origin, | 29 void Reserve(const url::Origin& origin, |
| 28 blink::mojom::BudgetOperationType operation, | 30 blink::mojom::BudgetOperationType operation, |
| 29 const ReserveCallback& callback) override; | 31 const ReserveCallback& callback) override; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // Render process ID is used to get the browser context. | 34 // Render process ID is used to get the browser context. |
| 33 int render_process_id_; | 35 int render_process_id_; |
| 34 | 36 |
| 35 DISALLOW_COPY_AND_ASSIGN(BudgetServiceImpl); | 37 DISALLOW_COPY_AND_ASSIGN(BudgetServiceImpl); |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ | 40 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_SERVICE_IMPL_H_ |
| OLD | NEW |