| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/signin/core/browser/webdata/token_web_data.h" | 5 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/ref_counted_delete_on_message_loop.h" | 9 #include "base/memory/ref_counted_delete_on_message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (TokenServiceTable::FromWebDatabase(db)->SetTokenForService(service, | 43 if (TokenServiceTable::FromWebDatabase(db)->SetTokenForService(service, |
| 44 token)) { | 44 token)) { |
| 45 return WebDatabase::COMMIT_NEEDED; | 45 return WebDatabase::COMMIT_NEEDED; |
| 46 } | 46 } |
| 47 return WebDatabase::COMMIT_NOT_NEEDED; | 47 return WebDatabase::COMMIT_NOT_NEEDED; |
| 48 } | 48 } |
| 49 | 49 |
| 50 std::unique_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) { | 50 std::unique_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) { |
| 51 std::map<std::string, std::string> map; | 51 std::map<std::string, std::string> map; |
| 52 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); | 52 TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); |
| 53 return base::WrapUnique( | 53 return base::MakeUnique<WDResult<std::map<std::string, std::string>>>( |
| 54 new WDResult<std::map<std::string, std::string>>(TOKEN_RESULT, map)); | 54 TOKEN_RESULT, map); |
| 55 } | 55 } |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 virtual ~TokenWebDataBackend() { | 58 virtual ~TokenWebDataBackend() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>; | 62 friend class base::RefCountedDeleteOnMessageLoop<TokenWebDataBackend>; |
| 63 friend class base::DeleteHelper<TokenWebDataBackend>; | 63 friend class base::DeleteHelper<TokenWebDataBackend>; |
| 64 }; | 64 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 TokenWebData::TokenWebData( | 100 TokenWebData::TokenWebData( |
| 101 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, | 101 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, |
| 102 scoped_refptr<base::SingleThreadTaskRunner> db_thread) | 102 scoped_refptr<base::SingleThreadTaskRunner> db_thread) |
| 103 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread), | 103 : WebDataServiceBase(NULL, ProfileErrorCallback(), ui_thread), |
| 104 token_backend_(new TokenWebDataBackend(db_thread)) { | 104 token_backend_(new TokenWebDataBackend(db_thread)) { |
| 105 } | 105 } |
| 106 | 106 |
| 107 TokenWebData::~TokenWebData() { | 107 TokenWebData::~TokenWebData() { |
| 108 } | 108 } |
| OLD | NEW |