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

Side by Side Diff: google_apis/gcm/engine/gcm_store_impl.cc

Issue 226223005: Revert of Removing the mock-keychain related bool from GCMStore constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months 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 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 "google_apis/gcm/engine/gcm_store_impl.h" 5 #include "google_apis/gcm/engine/gcm_store_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 LOG(ERROR) << "Failed to restore last checkin time. Using default = 0."; 598 LOG(ERROR) << "Failed to restore last checkin time. Using default = 0.";
599 599
600 // In case we cannot read last checkin time, we default it to 0, as we don't 600 // In case we cannot read last checkin time, we default it to 0, as we don't
601 // want that situation to cause the whole load to fail. 601 // want that situation to cause the whole load to fail.
602 *last_checkin_time = base::Time::FromInternalValue(time_internal); 602 *last_checkin_time = base::Time::FromInternalValue(time_internal);
603 603
604 return true; 604 return true;
605 } 605 }
606 606
607 GCMStoreImpl::GCMStoreImpl( 607 GCMStoreImpl::GCMStoreImpl(
608 bool use_mock_keychain,
608 const base::FilePath& path, 609 const base::FilePath& path,
609 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) 610 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner)
610 : backend_(new Backend(path, base::MessageLoopProxy::current())), 611 : backend_(new Backend(path, base::MessageLoopProxy::current())),
611 blocking_task_runner_(blocking_task_runner), 612 blocking_task_runner_(blocking_task_runner),
612 weak_ptr_factory_(this) { 613 weak_ptr_factory_(this) {
614 // On OSX, prevent the Keychain permissions popup during unit tests.
615 #if defined(OS_MACOSX)
616 OSCrypt::UseMockKeychain(use_mock_keychain);
617 #endif
613 } 618 }
614 619
615 GCMStoreImpl::~GCMStoreImpl() {} 620 GCMStoreImpl::~GCMStoreImpl() {}
616 621
617 void GCMStoreImpl::Load(const LoadCallback& callback) { 622 void GCMStoreImpl::Load(const LoadCallback& callback) {
618 blocking_task_runner_->PostTask( 623 blocking_task_runner_->PostTask(
619 FROM_HERE, 624 FROM_HERE,
620 base::Bind(&GCMStoreImpl::Backend::Load, 625 base::Bind(&GCMStoreImpl::Backend::Load,
621 backend_, 626 backend_,
622 base::Bind(&GCMStoreImpl::LoadContinuation, 627 base::Bind(&GCMStoreImpl::LoadContinuation,
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 removed_message_counts.begin(); 835 removed_message_counts.begin();
831 iter != removed_message_counts.end(); ++iter) { 836 iter != removed_message_counts.end(); ++iter) {
832 DCHECK_NE(app_message_counts_.count(iter->first), 0U); 837 DCHECK_NE(app_message_counts_.count(iter->first), 0U);
833 app_message_counts_[iter->first] -= iter->second; 838 app_message_counts_[iter->first] -= iter->second;
834 DCHECK_GE(app_message_counts_[iter->first], 0); 839 DCHECK_GE(app_message_counts_[iter->first], 0);
835 } 840 }
836 callback.Run(true); 841 callback.Run(true);
837 } 842 }
838 843
839 } // namespace gcm 844 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl.h ('k') | google_apis/gcm/engine/gcm_store_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698