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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/sync_setup_helper.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_SYNC_SETUP_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_SYNC_SETUP_HELPER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "net/dns/mock_host_resolver.h"
14
15 class Profile;
16 class ProfileSyncServiceHarness;
17
18 namespace base {
19 class FilePath;
20 }
21
22 namespace extensions {
23
24 class SyncSetupHelper {
25 public:
26 SyncSetupHelper();
27
28 ~SyncSetupHelper();
29
30 // Performs one-time initialization to enable sync for a profile. Does nothing
31 // if sync is already enabled for the profile.
32 bool InitializeSync(Profile* profile);
33
34 // Helper method used to read GAIA credentials from a local password file.
35 // Note: The password file must be a plain text file with two lines.
36 // The username is on the first line and the password is on the second line.
37 bool ReadPasswordFile(const base::FilePath& passwordFile);
38
39 const std::string& client_id() const { return client_id_; }
40 const std::string& client_secret() const { return client_secret_; }
41 const std::string& refresh_token() const { return refresh_token_; }
42
43 private:
44 // Block until all sync clients have completed their mutual sync cycles.
45 // Return true if a quiescent state was successfully reached.
46 bool AwaitQuiescence();
47
48 // GAIA account used by the test case.
49 std::string username_;
50
51 // GAIA password used by the test case.
52 std::string password_;
53
54 // GAIA client id for making the API call to push messaging.
55 std::string client_id_;
56
57 // GAIA client secret for making the API call to push messaging.
58 std::string client_secret_;
59
60 // GAIA refresh token for making the API call to push messaging.
61 std::string refresh_token_;
62
63 // The sync profile used by a test. The profile is owned by the
64 // ProfileManager.
65 Profile* profile_;
66
67 // Sync client used by a test. A sync client is associated with
68 // a sync profile, and implements methods that sync the contents of the
69 // profile with the server.
70 scoped_ptr<ProfileSyncServiceHarness> client_;
71
72 // This test needs to make live DNS requests for access to
73 // GAIA and sync server URLs under google.com. We use a scoped version
74 // to override the default resolver while the test is active.
75 scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_;
76
77 DISALLOW_COPY_AND_ASSIGN(SyncSetupHelper);
78 };
79
80 } // namespace extensions
81
82 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_SYNC_SETUP_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698