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

Unified Diff: chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc

Issue 1018643003: Removing chrome.pushMessaging API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to documentation per kalman's comments Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc
diff --git a/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc b/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc
deleted file mode 100644
index 933dce6c9ec0f80b04bbc2fe5dc50b719e4329fd..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/api/push_messaging/sync_setup_helper.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/api/push_messaging/sync_setup_helper.h"
-
-#include <vector>
-
-#include "base/files/file_util.h"
-#include "base/strings/string_util.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/history/history_service_factory.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/common/chrome_paths.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace extensions {
-
-SyncSetupHelper::SyncSetupHelper() {}
-
-SyncSetupHelper::~SyncSetupHelper() {}
-
-bool SyncSetupHelper::InitializeSync(Profile* profile) {
- profile_ = profile;
- client_.reset(ProfileSyncServiceHarness::Create(
- profile_,
- username_,
- password_,
- ProfileSyncServiceHarness::SigninType::FAKE_SIGNIN));
-
- if (client_->service()->IsSyncEnabledAndLoggedIn())
- return true;
-
- if (!client_->SetupSync())
- return false;
-
- // Because clients may modify sync data as part of startup (for example local
- // session-releated data is rewritten), we need to ensure all startup-based
- // changes have propagated between the clients.
- // This could take several seconds.
- AwaitQuiescence();
- return true;
-}
-
-// Read the sync signin credentials from a file on the machine.
-bool SyncSetupHelper::ReadPasswordFile(const base::FilePath& password_file) {
- // TODO(dcheng): Convert format of config file to JSON.
- std::string file_contents;
- bool success = base::ReadFileToString(password_file, &file_contents);
- EXPECT_TRUE(success)
- << "Password file \""
- << password_file.value() << "\" does not exist.";
- if (!success)
- return false;
-
- std::vector<std::string> tokens;
- std::string delimiters = "\r\n";
- Tokenize(file_contents, delimiters, &tokens);
- EXPECT_EQ(5U, tokens.size()) << "Password file \""
- << password_file.value()
- << "\" must contain exactly five lines of text.";
- if (5U != tokens.size())
- return false;
- username_ = tokens[0];
- password_ = tokens[1];
- client_id_ = tokens[2];
- client_secret_ = tokens[3];
- refresh_token_ = tokens[4];
- return true;
-}
-
-bool SyncSetupHelper::AwaitQuiescence() {
- std::vector<ProfileSyncServiceHarness*> clients;
- clients.push_back(client_.get());
- return ProfileSyncServiceHarness::AwaitQuiescence(clients);
-}
-
-} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698