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

Side by Side Diff: components/invalidation/invalidation_service_util.cc

Issue 1191393008: Introduce a layering in the invalidation component as public and impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicitly forbid content to prevent future additions Created 5 years, 6 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 2014 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 #include "components/invalidation/invalidation_service_util.h"
6
7 #include "base/base64.h"
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "base/rand_util.h"
11 #include "components/invalidation/invalidation_switches.h"
12
13 namespace invalidation {
14
15 notifier::NotifierOptions ParseNotifierOptions(
16 const base::CommandLine& command_line) {
17 notifier::NotifierOptions notifier_options;
18
19 if (command_line.HasSwitch(switches::kSyncNotificationHostPort)) {
20 notifier_options.xmpp_host_port =
21 net::HostPortPair::FromString(
22 command_line.GetSwitchValueASCII(
23 switches::kSyncNotificationHostPort));
24 DVLOG(1) << "Using " << notifier_options.xmpp_host_port.ToString()
25 << " for test sync notification server.";
26 }
27
28 notifier_options.allow_insecure_connection =
29 command_line.HasSwitch(switches::kSyncAllowInsecureXmppConnection);
30 DVLOG_IF(1, notifier_options.allow_insecure_connection)
31 << "Allowing insecure XMPP connections.";
32
33 return notifier_options;
34 }
35
36 std::string GenerateInvalidatorClientId() {
37 // Generate a GUID with 128 bits worth of base64-encoded randomness.
38 // This format is similar to that of sync's cache_guid.
39 const int kGuidBytes = 128 / 8;
40 std::string guid;
41 base::Base64Encode(base::RandBytesAsString(kGuidBytes), &guid);
42 DCHECK(!guid.empty());
43 return guid;
44 }
45
46 } // namespace invalidation
OLDNEW
« no previous file with comments | « components/invalidation/invalidation_service_util.h ('k') | components/invalidation/invalidation_state_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698