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

Side by Side Diff: chrome/browser/policy/device_token_fetcher.h

Issue 10664017: Introduce a new error code from the DM server - 402 - missing licenses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ 6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 PolicyNotifier* notifier, 44 PolicyNotifier* notifier,
45 DelayedWorkScheduler* scheduler); 45 DelayedWorkScheduler* scheduler);
46 virtual ~DeviceTokenFetcher(); 46 virtual ~DeviceTokenFetcher();
47 47
48 // Starts fetching a token. 48 // Starts fetching a token.
49 // Declared virtual so it can be overridden by mocks. 49 // Declared virtual so it can be overridden by mocks.
50 virtual void FetchToken(); 50 virtual void FetchToken();
51 51
52 virtual void SetUnmanagedState(); 52 virtual void SetUnmanagedState();
53 virtual void SetSerialNumberInvalidState(); 53 virtual void SetSerialNumberInvalidState();
54 virtual void SetMissingLicensesState();
54 55
55 // Cancels any pending work on this fetcher and resets it to inactive state. 56 // Cancels any pending work on this fetcher and resets it to inactive state.
56 void Reset(); 57 void Reset();
57 58
58 private: 59 private:
59 friend class DeviceTokenFetcherTest; 60 friend class DeviceTokenFetcherTest;
60 61
61 // The different states that the fetcher can be in during the process of 62 // The different states that the fetcher can be in during the process of
62 // getting the device token. |state_| is initialized to INACTIVE, depending 63 // getting the device token. |state_| is initialized to INACTIVE, depending
63 // on the result of a token fetching attempt can transition to either of 64 // on the result of a token fetching attempt can transition to either of
64 // TOKEN_AVAILABLE, UNMANAGED, or ERROR. The first attempt must be triggered 65 // TOKEN_AVAILABLE, UNMANAGED, or ERROR. The first attempt must be triggered
65 // externally. When |state_| is UNMANAGED, a new fetching attempt is 66 // externally. When |state_| is UNMANAGED, a new fetching attempt is
66 // performed every |unmanaged_device_refresh_rate_ms_|; when it's ERROR, 67 // performed every |unmanaged_device_refresh_rate_ms_|; when it's ERROR,
67 // a new attempt is done after |effective_token_fetch_error_delay_ms_|. 68 // a new attempt is done after |effective_token_fetch_error_delay_ms_|.
68 enum FetcherState { 69 enum FetcherState {
69 // Fetcher inactive. 70 // Fetcher inactive.
70 STATE_INACTIVE, 71 STATE_INACTIVE,
71 // Token available. 72 // Token available.
72 STATE_TOKEN_AVAILABLE, 73 STATE_TOKEN_AVAILABLE,
73 // Device unmanaged. 74 // Device unmanaged.
74 STATE_UNMANAGED, 75 STATE_UNMANAGED,
75 // The device is not enlisted for the domain. 76 // The device is not enlisted for the domain.
76 STATE_BAD_SERIAL, 77 STATE_BAD_SERIAL,
78 // The licenses for the domain has expired or have been exhausted.
Mattias Nissler (ping if slow) 2012/06/26 09:19:34 s/has/have/
pastarmovj 2012/06/26 16:59:29 Done.
79 STATE_MISSING_LICENSES,
77 // Error, retry later. 80 // Error, retry later.
78 STATE_ERROR, 81 STATE_ERROR,
79 // Temporary error. Retry sooner. 82 // Temporary error. Retry sooner.
80 STATE_TEMPORARY_ERROR, 83 STATE_TEMPORARY_ERROR,
81 // Server rejected the auth token. 84 // Server rejected the auth token.
82 STATE_BAD_AUTH, 85 STATE_BAD_AUTH,
83 // Server didn't send enrollment mode or the enrollment mode is not known to 86 // Server didn't send enrollment mode or the enrollment mode is not known to
84 // the client. 87 // the client.
85 STATE_BAD_ENROLLMENT_MODE, 88 STATE_BAD_ENROLLMENT_MODE,
86 }; 89 };
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 CloudPolicyDataStore* data_store_; 129 CloudPolicyDataStore* data_store_;
127 130
128 scoped_ptr<DelayedWorkScheduler> scheduler_; 131 scoped_ptr<DelayedWorkScheduler> scheduler_;
129 132
130 DISALLOW_COPY_AND_ASSIGN(DeviceTokenFetcher); 133 DISALLOW_COPY_AND_ASSIGN(DeviceTokenFetcher);
131 }; 134 };
132 135
133 } // namespace policy 136 } // namespace policy
134 137
135 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ 138 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698