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

Side by Side Diff: chrome/common/net/gaia/google_service_auth_error.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/common/jstemplate_builder.h ('k') | chrome/common/persistent_pref_store.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // A GoogleServiceAuthError is immutable, plain old data representing an 5 // A GoogleServiceAuthError is immutable, plain old data representing an
6 // error from an attempt to authenticate with a Google service. 6 // error from an attempt to authenticate with a Google service.
7 // It could be from Google Accounts itself, or any service using Google 7 // It could be from Google Accounts itself, or any service using Google
8 // Accounts (e.g expired credentials). It may contain additional data such as 8 // Accounts (e.g expired credentials). It may contain additional data such as
9 // captcha challenges. 9 // captcha challenges.
10 10
11 // A GoogleServiceAuthError without additional data is just a State, defined 11 // A GoogleServiceAuthError without additional data is just a State, defined
12 // below. A case could be made to have this relation implicit, to allow raising 12 // below. A case could be made to have this relation implicit, to allow raising
13 // error events concisely by doing OnAuthError(GoogleServiceAuthError::NONE), 13 // error events concisely by doing OnAuthError(GoogleServiceAuthError::NONE),
14 // for example. But the truth is this class is ever so slightly more than a 14 // for example. But the truth is this class is ever so slightly more than a
15 // transparent wrapper around 'State' due to additional Captcha data 15 // transparent wrapper around 'State' due to additional Captcha data
16 // (e.g consider operator=), and this would violate the style guide. Thus, 16 // (e.g consider operator=), and this would violate the style guide. Thus,
17 // you must explicitly use the constructor when all you have is a State. 17 // you must explicitly use the constructor when all you have is a State.
18 // The good news is the implementation nests the enum inside a class, so you 18 // The good news is the implementation nests the enum inside a class, so you
19 // may forward declare and typedef GoogleServiceAuthError to something shorter 19 // may forward declare and typedef GoogleServiceAuthError to something shorter
20 // in the comfort of your own translation unit. 20 // in the comfort of your own translation unit.
21 21
22 #ifndef CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ 22 #ifndef CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_
23 #define CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ 23 #define CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_
24 #pragma once 24 #pragma once
25 25
26 #include <string> 26 #include <string>
27 27
28 #include "googleurl/src/gurl.h" 28 #include "googleurl/src/gurl.h"
29 29
30 namespace base {
30 class DictionaryValue; 31 class DictionaryValue;
32 }
31 33
32 class GoogleServiceAuthError { 34 class GoogleServiceAuthError {
33 public: 35 public:
34 // 36 //
35 // These enumerations are referenced by integer value in HTML login code. 37 // These enumerations are referenced by integer value in HTML login code.
36 // Do not change the numeric values. 38 // Do not change the numeric values.
37 // 39 //
38 enum State { 40 enum State {
39 // The user is authenticated. 41 // The user is authenticated.
40 NONE = 0, 42 NONE = 0,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // to explicit class and State enum relation. Note: shouldn't be inlined! 109 // to explicit class and State enum relation. Note: shouldn't be inlined!
108 static GoogleServiceAuthError None(); 110 static GoogleServiceAuthError None();
109 111
110 // The error information. 112 // The error information.
111 const State& state() const; 113 const State& state() const;
112 const Captcha& captcha() const; 114 const Captcha& captcha() const;
113 int network_error() const; 115 int network_error() const;
114 116
115 // Returns info about this object in a dictionary. Caller takes 117 // Returns info about this object in a dictionary. Caller takes
116 // ownership of returned dictionary. 118 // ownership of returned dictionary.
117 DictionaryValue* ToValue() const; 119 base::DictionaryValue* ToValue() const;
118 120
119 private: 121 private:
120 GoogleServiceAuthError(State s, int error); 122 GoogleServiceAuthError(State s, int error);
121 123
122 GoogleServiceAuthError(State s, const std::string& captcha_token, 124 GoogleServiceAuthError(State s, const std::string& captcha_token,
123 const GURL& captcha_image_url, 125 const GURL& captcha_image_url,
124 const GURL& captcha_unlock_url); 126 const GURL& captcha_unlock_url);
125 127
126 State state_; 128 State state_;
127 Captcha captcha_; 129 Captcha captcha_;
128 int network_error_; 130 int network_error_;
129 }; 131 };
130 132
131 #endif // CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ 133 #endif // CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_
OLDNEW
« no previous file with comments | « chrome/common/jstemplate_builder.h ('k') | chrome/common/persistent_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698