OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extensions/api/identity/identity_mint_queue.h" | 5 #include "chrome/browser/extensions/api/identity/identity_mint_queue.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 request, | 66 request, |
67 "completed", | 67 "completed", |
68 "RequestCancel"); | 68 "RequestCancel"); |
69 GetRequestQueueMap(MINT_TYPE_INTERACTIVE)[key].remove(request); | 69 GetRequestQueueMap(MINT_TYPE_INTERACTIVE)[key].remove(request); |
70 GetRequestQueueMap(MINT_TYPE_NONINTERACTIVE)[key].remove(request); | 70 GetRequestQueueMap(MINT_TYPE_NONINTERACTIVE)[key].remove(request); |
71 } | 71 } |
72 | 72 |
73 bool IdentityMintRequestQueue::empty(IdentityMintRequestQueue::MintType type, | 73 bool IdentityMintRequestQueue::empty(IdentityMintRequestQueue::MintType type, |
74 const ExtensionTokenKey& key) { | 74 const ExtensionTokenKey& key) { |
75 RequestQueueMap& request_queue_map = GetRequestQueueMap(type); | 75 RequestQueueMap& request_queue_map = GetRequestQueueMap(type); |
76 return !ContainsKey(request_queue_map, key) || | 76 return !base::ContainsKey(request_queue_map, key) || |
77 (request_queue_map.find(key))->second.empty(); | 77 (request_queue_map.find(key))->second.empty(); |
78 } | 78 } |
79 | 79 |
80 IdentityMintRequestQueue::RequestQueueMap& | 80 IdentityMintRequestQueue::RequestQueueMap& |
81 IdentityMintRequestQueue::GetRequestQueueMap( | 81 IdentityMintRequestQueue::GetRequestQueueMap( |
82 IdentityMintRequestQueue::MintType type) { | 82 IdentityMintRequestQueue::MintType type) { |
83 return (type == MINT_TYPE_INTERACTIVE) ? interactive_request_queue_map_ | 83 return (type == MINT_TYPE_INTERACTIVE) ? interactive_request_queue_map_ |
84 : noninteractive_request_queue_map_; | 84 : noninteractive_request_queue_map_; |
85 } | 85 } |
86 | 86 |
87 void IdentityMintRequestQueue::RunRequest( | 87 void IdentityMintRequestQueue::RunRequest( |
88 IdentityMintRequestQueue::MintType type, | 88 IdentityMintRequestQueue::MintType type, |
89 RequestQueue& request_queue) { | 89 RequestQueue& request_queue) { |
90 TRACE_EVENT_ASYNC_STEP_INTO0( | 90 TRACE_EVENT_ASYNC_STEP_INTO0( |
91 "identity", "IdentityMintRequestQueue", request_queue.front(), "RUNNING"); | 91 "identity", "IdentityMintRequestQueue", request_queue.front(), "RUNNING"); |
92 request_queue.front()->StartMintToken(type); | 92 request_queue.front()->StartMintToken(type); |
93 } | 93 } |
94 | 94 |
95 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |