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

Side by Side Diff: chrome/browser/budget_service/budget_manager.cc

Issue 2522553003: Mojo C++ bindings: switch WebKit mojom targets to use STL/WTF types. (Closed)
Patch Set: . Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #include "chrome/browser/budget_service/budget_manager.h" 5 #include "chrome/browser/budget_service/budget_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // No default case. 64 // No default case.
65 } 65 }
66 NOTREACHED(); 66 NOTREACHED();
67 return SiteEngagementScore::kMaxPoints + 1.0; 67 return SiteEngagementScore::kMaxPoints + 1.0;
68 } 68 }
69 69
70 void BudgetManager::GetBudget(const url::Origin& origin, 70 void BudgetManager::GetBudget(const url::Origin& origin,
71 const GetBudgetCallback& callback) { 71 const GetBudgetCallback& callback) {
72 if (origin.unique() || !content::IsOriginSecure(origin.GetURL())) { 72 if (origin.unique() || !content::IsOriginSecure(origin.GetURL())) {
73 callback.Run(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED, 73 callback.Run(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED,
74 mojo::Array<blink::mojom::BudgetStatePtr>()); 74 std::vector<blink::mojom::BudgetStatePtr>());
75 return; 75 return;
76 } 76 }
77 db_.GetBudgetDetails(origin, callback); 77 db_.GetBudgetDetails(origin, callback);
78 } 78 }
79 79
80 void BudgetManager::Reserve(const url::Origin& origin, 80 void BudgetManager::Reserve(const url::Origin& origin,
81 blink::mojom::BudgetOperationType type, 81 blink::mojom::BudgetOperationType type,
82 const ReserveCallback& callback) { 82 const ReserveCallback& callback) {
83 if (origin.unique() || !content::IsOriginSecure(origin.GetURL())) { 83 if (origin.unique() || !content::IsOriginSecure(origin.GetURL())) {
84 callback.Run(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED, 84 callback.Run(blink::mojom::BudgetServiceErrorType::NOT_SUPPORTED,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void BudgetManager::DidReserve(const url::Origin& origin, 137 void BudgetManager::DidReserve(const url::Origin& origin,
138 const ReserveCallback& callback, 138 const ReserveCallback& callback,
139 blink::mojom::BudgetServiceErrorType error, 139 blink::mojom::BudgetServiceErrorType error,
140 bool success) { 140 bool success) {
141 // If the call succeeded, write the new reservation into the map. 141 // If the call succeeded, write the new reservation into the map.
142 if (success && error == blink::mojom::BudgetServiceErrorType::NONE) 142 if (success && error == blink::mojom::BudgetServiceErrorType::NONE)
143 reservation_map_[origin]++; 143 reservation_map_[origin]++;
144 144
145 callback.Run(error, success); 145 callback.Run(error, success);
146 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698