Index: chrome/browser/budget_service/budget_service_impl.cc |
diff --git a/chrome/browser/budget_service/budget_service_impl.cc b/chrome/browser/budget_service/budget_service_impl.cc |
index 5a6b8b857681a27b94605ddd76559a3f0e74569a..cae6efd6797e930894ffd9742428437b560bb48f 100644 |
--- a/chrome/browser/budget_service/budget_service_impl.cc |
+++ b/chrome/browser/budget_service/budget_service_impl.cc |
@@ -39,7 +39,16 @@ void BudgetServiceImpl::GetCost(blink::mojom::BudgetOperationType type, |
void BudgetServiceImpl::GetBudget(const url::Origin& origin, |
const GetBudgetCallback& callback) { |
- // TODO(harkness) Call the BudgetManager once it supports detailed GetBudget |
- // calls. |
- callback.Run(0); |
+ // The RenderProcessHost should still be alive as long as any connections are |
+ // alive, and if the BudgetService mojo connection is down, the |
+ // BudgetServiceImpl should have been destroyed. |
+ content::RenderProcessHost* host = |
+ content::RenderProcessHost::FromID(render_process_id_); |
+ DCHECK(host); |
+ |
+ // Query the BudgetManager for the budget. |
+ content::BrowserContext* context = host->GetBrowserContext(); |
+ // TODO(harkness): Convert BudgetManager to use url::Origin. |
+ const GURL gurl(origin.Serialize()); |
+ BudgetManagerFactory::GetForProfile(context)->GetBudget(gurl, callback); |
} |