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

Side by Side Diff: remoting/host/gcd_state_updater.cc

Issue 1123163002: Updated remoting host to create instances of GCD-related classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-xmpp-connect2c
Patch Set: Moved ownership of GcdRestClient to GcdStateUpdater 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
« no previous file with comments | « remoting/host/gcd_state_updater.h ('k') | remoting/host/gcd_state_updater_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/host/gcd_state_updater.h" 5 #include "remoting/host/gcd_state_updater.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/strings/stringize_macros.h" 8 #include "base/strings/stringize_macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "remoting/base/constants.h" 11 #include "remoting/base/constants.h"
12 #include "remoting/base/logging.h" 12 #include "remoting/base/logging.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 15
16 namespace { 16 namespace {
17 17
18 const int64 kTimerIntervalMinMs = 1000; 18 const int64 kTimerIntervalMinMs = 1000;
19 const int64 kTimerIntervalMaxMs = 5 * 60 * 1000; // 5 minutes 19 const int64 kTimerIntervalMaxMs = 5 * 60 * 1000; // 5 minutes
20 20
21 } // namespace 21 } // namespace
22 22
23 GcdStateUpdater::GcdStateUpdater( 23 GcdStateUpdater::GcdStateUpdater(
24 const base::Closure& on_update_successful_callback, 24 const base::Closure& on_update_successful_callback,
25 const base::Closure& on_unknown_host_id_error, 25 const base::Closure& on_unknown_host_id_error,
26 SignalStrategy* signal_strategy, 26 SignalStrategy* signal_strategy,
27 GcdRestClient* gcd_rest_client) 27 scoped_ptr<GcdRestClient> gcd_rest_client)
28 : on_update_successful_callback_(on_update_successful_callback), 28 : on_update_successful_callback_(on_update_successful_callback),
29 on_unknown_host_id_error_(on_unknown_host_id_error), 29 on_unknown_host_id_error_(on_unknown_host_id_error),
30 signal_strategy_(signal_strategy), 30 signal_strategy_(signal_strategy),
31 gcd_rest_client_(gcd_rest_client) { 31 gcd_rest_client_(gcd_rest_client.Pass()) {
32 DCHECK(signal_strategy_); 32 DCHECK(signal_strategy_);
33 DCHECK(thread_checker_.CalledOnValidThread()); 33 DCHECK(thread_checker_.CalledOnValidThread());
34 34
35 signal_strategy_->AddListener(this); 35 signal_strategy_->AddListener(this);
36 36
37 // Update state if the |signal_strategy_| is already connected. 37 // Update state if the |signal_strategy_| is already connected.
38 OnSignalStrategyStateChange(signal_strategy_->GetState()); 38 OnSignalStrategyStateChange(signal_strategy_->GetState());
39 } 39 }
40 40
41 GcdStateUpdater::~GcdStateUpdater() { 41 GcdStateUpdater::~GcdStateUpdater() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 patch->SetString("_jabberId", pending_request_jid_); 118 patch->SetString("_jabberId", pending_request_jid_);
119 patch->SetString("_hostVersion", STRINGIZE(VERSION)); 119 patch->SetString("_hostVersion", STRINGIZE(VERSION));
120 120
121 // Send the update to GCD. 121 // Send the update to GCD.
122 gcd_rest_client_->PatchState( 122 gcd_rest_client_->PatchState(
123 patch.Pass(), 123 patch.Pass(),
124 base::Bind(&GcdStateUpdater::OnPatchStateStatus, base::Unretained(this))); 124 base::Bind(&GcdStateUpdater::OnPatchStateStatus, base::Unretained(this)));
125 } 125 }
126 126
127 } // namespace remoting 127 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/gcd_state_updater.h ('k') | remoting/host/gcd_state_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698